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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:46:59+00:00 2026-06-07T16:46:59+00:00

I have this code that works fine: if (typeof jQuery === undefined || jQuery.fn.jquery

  • 0

I have this code that works fine:

if (typeof jQuery === "undefined" || jQuery.fn.jquery !== '1.4.2') {
var script_tag = document.createElement('script');
script_tag.setAttribute("type","text/javascript");
script_tag.setAttribute("src","http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
script_tag.onload = main; // Run main() once jQuery has loaded
script_tag.onreadystatechange = function () { // Same thing but for IE
if (this.readyState == 'complete' || this.readyState == 'loaded') main();
}
document.getElementsByTagName("head")[0].appendChild(script_tag);
} else {
    main();
}

but when i try to compress it through bookmarkleter I have “unexpected identifier” error

javascript:(function(){if(typeof%20jQuery===%22undefined%22%20||%20jQuery.fn.jquery%20!=='1.4.2'){var%20script_tag=document.createElement('script');script_tag.setAttribute(%22type%22,%22text/javascript%22);script_tag.setAttribute(%22src%22,%22http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js%22);script_tag.onload=main;script_tag.onreadystatechange=function(){if(this.readyState=='complete'%20||%20this.readyState=='loaded')main();}document.getElementsByTagName(%22head%22)[0].appendChild(script_tag);}else{main();}})();

suggestion?

thanks

  • 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-06-07T16:47:01+00:00Added an answer on June 7, 2026 at 4:47 pm

    Not sure if this is a bug in bookmarkleter or not, but you need a semi-colon before document.getElementsByTagName("head")[0].appendChild(script_tag); if it’s going to all be squeezed into one line like that.

    Once you do that, the unexpected identifier error goes away. You will get a new error of “main is not defined” unless you have in fact already defined main previously.

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

Sidebar

Related Questions

I have this piece of code that works fine in subsonic 2.2, I migrated
i have this code: lvItem.pszText = (IntPtr)(lpRemoteBuffer + Marshal.SizeOf(typeof(LV_ITEM))); it works fine on 4.0.
I have this code that works in a unit test but doesn't work when
I have this code that works well: {livre:empty_name} $.ajax({ url: sent.php, type: post, dataType:
I have the following code: Bear in mind that while this code works on
I have this piece of code that does not work: public CartaoCidadao() { InitializeComponent();
I have the this code that will create excel file and work sheet then
I have this code that I've edited: http://pastebin.com/vrqHek6S I've put in comments where I
I have this code that runs but never stops. class A { public static
I have this code that reads from XML file. It gets five strings (groupId,

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.