How can I add a JavaScript snippet to the head of a CMS page?

I don't want to reference a JS file.

Instead I would like to add the piece of JS directly (it is to preload an image so only 2 lines).

2 Answers 2


you can simply add in the content area of your cms page the js:

<script type="text/javascript">
    //your js here

you can simple add you in design tab Layout Update XML field

<reference name="head">
        <action method="addJs">


you script will be added in head.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.