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

  • Home
  • SEARCH
  • 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 6604491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:09:48+00:00 2026-05-25T19:09:48+00:00

I have all a websites HTML stored in a javascript string & I want

  • 0

I have all a websites HTML stored in a javascript string & I want to place it inside an iframe. How can I place that HTML string into the iframe & make it show the website? I have tried this.src = HTML_STR; this.innerHTML = HTML_STR; but they dont show the HTML_STR.

I understand that this maybe silly because instead of having the websites HTML in a string I could just set the iframes src to the website & show the website that way.

BUT the reason I am doing this is because its a website updater. So I want to get the website (that I am updating) HTML, convert all the elements with the class “updatable” to textareas(so they can be updated) then show that HTML in the iframe.

The other reason for using an iframe & not just chucking the HTML in a div, is because each website imports a .css style sheet & I dont want their css file to affect my updater websites css or have my updater .css affect the websites HTML look thus if I show the website in an iframe each websites css wont affect each other.

For example if updater.css has the following it will affect all the p elements in the other websites html:

p { background-color: red; width: 50%; }

So is there a way to insert my own HTML into an iframe. Or is there another way to achieve what I am trying to do.

  • 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-25T19:09:49+00:00Added an answer on May 25, 2026 at 7:09 pm

    Assuming that you want to write to the iframe from the parent, you could do this:

    var ifrm = document.getElementById('myFrame');
    ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;
    ifrm.document.open();
    ifrm.document.write('Hello World!');
    ifrm.document.close();
    

    Here’s a working jsFiddle. Original code taken from here and here.

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

Sidebar

Related Questions

I have a website with friendly urls. I want all url´s that end with
I use bzr for websites. I have all my current ones set up so
I have a website with several forms that all pass the same set of
I have a website that employs a generic mod_rewrite rule to push all requests
I am new to html world . I build all our websites with flex
I have some static websites. By static I mean all the pages are simple
I have some document stored as a large String. In the String I have
HTML Email is a whole different ballgame from Websites , which have moved away
I have all the web pages of a website. My task is to change
I have a website with all my photos, I would like people to be

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.