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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:50:55+00:00 2026-05-30T06:50:55+00:00

I have a use case that I am experimenting with – sandboxing many different

  • 0

I have a use case that I am experimenting with – sandboxing many different JS libraries to hidden iframes. In the site, there can be many widgets, all from the same domain, that may require different version of js libraries. To prevent global conflicts i thought it would be interesting to place all of their required libraries into iframes. So in one iframe I may have jQuery 1.7.1, but in others there may be something older. What I would like to do is to have the code running on each iframe be able to make changes to the main window. I was able to make this work by tweaking the “document” variable in jQuery source to point at “var document = top.document.

Using this approach I was able to execute, in an iframe, $(“body”).append(‘test”) and have it modify the parent document.

Can anyone suggest a better approach to doing something like this? or a better sandbox approach?

  • 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-30T06:50:57+00:00Added an answer on May 30, 2026 at 6:50 am

    If you don’t want to edit the jQuery, I believe this works:

    $(document, parent.window.document).contents().find('body').append('test');
    

    This way, you could use the jQuery lib from within the iframe as well, but if you’re hiding them anyway your solution is likely more ideal for your purposes.

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

Sidebar

Related Questions

I have the following use case: There's a class called Template and with that
I have a use case that to hook up the topic to many queues.
That is, I'd like to have a tuple of values. The use case on
I have a use case that I've never really dealt with before. I have
I have this use case that is very similar to the robot-legs example of
We have the use case that we need to output text that is a
I currently have a Use Case Diagram that is similar to the above one:
I have an R / ggplot2 use case that seems to call for geom_raster
I'm just starting to learn AspectJ, and I have use-case for say, User login.
Have a use case wherein need to maintain a connection open to a database

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.