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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:48:13+00:00 2026-05-24T03:48:13+00:00

I’m building a service that allows people to put a javascript code I gave

  • 0

I’m building a service that allows people to put a javascript code I gave them to their site.
The javascript code is based on jQuery.

My question is how to do this to be safe and optimized, cause I don’t want to break certain users website.

The thing I’m looking for so far( you can update if you think I need to face other problems):

  1. what happens when the user already has jquery loaded on their page? should I load my jquery library using different namespace or should I use his jquery library.
  2. in case I can use his jquery library, I think I’ll need to check to see if the versions corespond, but again is this safe?
  3. in case I want to use his jquery library, how do I check if he has jquery loaded and if he has the right version
  4. this is related to 3. what happen if he changes his jquery library that doesn’t correspond with the library I think it will be, leading to a bad result.

Looking for your answers.
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-05-24T03:48:14+00:00Added an answer on May 24, 2026 at 3:48 am
    1. Don’t depend on the page’s jQuery or try to use it. This will just turn into a support nightmare. You can’t even be sure that a version is accurate, as the target page can alter its version of jQuery.

    2. The best approach is for your code to create and load an iFrame. This gives you complete control over the iFrame’s jQuery, CSS, etc. With vastly reduced chances of conflict.

    3. If the iFrame approach is not possible for some reason, Use noConflict to minimize the chance of conflicting jQuery versions.
      Something like this:

      <script type="text/javascript">
          if ($ || jQuery) {
              var PagesLibrary    = $;
              var PagesjQuery     = jQuery;
      </script>
      
      <!-- load your jQuery -->
      <script type="text/javascript" src="http://example.com/jquery-1.6.2.js"></script>
      <script type="text/javascript">
          var my_jQuery   = $.noConflict (true);
          if (PagesjQuery) {
              $               = PagesLibrary;
              jQuery          = PagesjQuery;
          }
      </script>
      

      Then instead of $('#selector').function();,
      Use: my_jQuery('#selector').function();.

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put

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.