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 4585832
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:33:07+00:00 2026-05-21T21:33:07+00:00

for some reason my Firefox4+GreaseMonkey Script loads jQuery twice. I copy’n’pasted the following snippet,

  • 0

for some reason my Firefox4+GreaseMonkey Script loads jQuery twice. I copy’n’pasted the following snippet, the “test” alert shows twice.

Regards

var $;

// Add jQuery
(function(){
    if (typeof unsafeWindow.jQuery == 'undefined') {
        var GM_Head = document.getElementsByTagName('head')[0] || document.documentElement,
            GM_JQ = document.createElement('script');

        GM_JQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';
        GM_JQ.type = 'text/javascript';
        GM_JQ.async = true;

        GM_Head.insertBefore(GM_JQ, GM_Head.firstChild);
    }
    GM_wait();
})();

// Check if jQuery's loaded
function GM_wait() {
    if (typeof unsafeWindow.jQuery == 'undefined') {
        window.setTimeout(GM_wait, 100);
    } else {
        $ = unsafeWindow.jQuery.noConflict(true);
        letsJQuery();
    }
}

// All your GM code must be inside this function
function letsJQuery() {
    alert("test");
}
  • 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-21T21:33:07+00:00Added an answer on May 21, 2026 at 9:33 pm

    This is probably because the target page is loading frames or iframes.

    Add these lines to the top of the code-portion of your script:

    if (window.top != window.self)  //-- Don't run on frames or iframes
        return;
    

    Also, if you are just using FF + GM, don’t bother with all that rigamarole to load jQuery. GM now works with the later jQuery versions.

    Just add a line like:

    // @require http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js
    

    into your script’s metadata block. jQuery will be copied once onto your local machine and run from there — eliminating what can sometimes be a few seconds delay in your script’s runtime.

    And such scripts can run in Chrome, if you use one of the GM-emulating extensions like TamperMonkey.

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

Sidebar

Related Questions

The following html code works in Firefox, but for some reason fails in IE
I have a jquery/ajax website at tarh33ls.com For some reason, in firefox, i get
For some reason, I am getting the following Javascript error in Internet Explorer 8
So, for some reason my script refuses to work, although it seems to be
I have a recaptcha code within a jQuery dialog. For some reason, when I
Greetings, I'm using the jQuery Asual Address plugin: http://www.asual.com/jquery/address/ For some reason, in Firefox
The following code for some reason poradically works. I have checked the URL so
For some reason, JQuery mobile is not rendering in Internet Explorer 9 on my
For some reason I never see this done. Is there a reason why not?
For some reason when I attempt to make a request to an Ajax.net web

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.