Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6634759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:58:03+00:00 2026-05-25T22:58:03+00:00

What is the recommended way to add jQuery (or any script) BEFORE the rest

  • 0

What is the recommended way to add jQuery (or any script) BEFORE the rest of the scripts that come with Magento using local.xml?

I’ve tried to use (in local.xml):

<reference name="head">
    <action method="addItem">
        <type>skin_js</type>
        <script>js/jquery-1.6.4.js</script>
    </action>
</reference>

but this ends up adding jQuery to the end of the scripts that are added by Magento in page.xml in the base package. I’ve even tried removing all the scripts using:

<action method="removeItem">
...
</action>

to remove all of the scripts that were added in page.xml and then re-adding them in local.xml in the order I need them to be in (jQuery first), but somehow, they are ending up in the same order (with jQuery last).

I’ve stepped through the Magento code and verified that the scripts are getting removed and then re-added to $this->_data[‘items’] in Mage_Page_Block_Html_Head, but at some point, when they get added to the page, they are added with jQuery last.

I’m guessing there has to be a more elegant way to do this, but I’ve yet to find it in my Googling. Everything I’ve found recommends modifying page.xml directly, which I’ve read elsewhere is not a good idea.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:58:03+00:00Added an answer on May 25, 2026 at 10:58 pm

    Best is to use the content delivery network which will be better in performance/speed for your website.

    I mostly just open up template/page/html/head.phtml and right before

    <?php echo $this->getCssJsHtml() ?>
    <?php echo $this->getChildHtml() ?>
    

    I add:

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
    

    Also make sure you run the jQuery.noConflict() method and always use the full jQuery name instead of the $ (dollar sign) to avoid conflicts with prototype 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've read in many sources that Google's recommended way to add GA code (
What is the recommended way of handling settings for local development and the production
Is there a recommended way of using Django to clean an input string without
I am designing a REST API and I wonder what the recommended way to
i'm using asual jquery-address, tabs example and want to add datepicker to the Extra
What is the recommended way of printing a text document as a pdf using
I want to use jQuery in an add on JS library that can be
What is the recommended way to embed PDF in HTML? iFrame? Object? Embed? What
Is there a recommended way to bounce an asp.net application besides touching web.config from
Which is the preferred/recommended way of handling events in .NET: this.Load += new EventHandler(Form1_Load);

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.