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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:39:04+00:00 2026-06-12T02:39:04+00:00

I am writing to an iframe via document.write then trying to overwrite the document

  • 0

I am writing to an iframe via document.write then trying to overwrite the document on that same iframe. In FF this works properly. However, in chrome code from the initial document.write persists even after I overwrite it with a second document.write.

See this fiddle: http://jsfiddle.net/meQcC/

If you view it in FF as one would expect, the iframe is blank and you actually get a “function onLoad is not defined error” because in the line

doc.write("<html><head><script>;" +
      "<\/script></head><body onload='onLoad()'></body></html>");

There is obviously no onLoad function defined. However, if you view the same fiddle in chrome, the iframe will display a black rectangle, and there will be no error regarding the onLoad call, it will call the previously defined function as though it still exists!!!!

Is there any way to clear the document in chrome so that I can overwrite the contents of the iframe without old code somehow persisting? Is this a bug in chrome?

  • 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-12T02:39:06+00:00Added an answer on June 12, 2026 at 2:39 am

    Yes, this is a bug in Chrome (or more precisely in WebKit). Per spec, it should be creating a new Window object and removing all global event listeners, and it’s not doing that.

    In particular, see http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#dom-document-open step 14.

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

Sidebar

Related Questions

I'm busy writing a application that refreshes a IFrame completely using javascript, now my
Before starting writing this question, i was trying to solve following // 1. navigate
I am writing a GWT app that involves interacting with an external document in
I'm writing a javascript function that dynamically creates an Iframe with a button that
So I've got this PHP that's writing some JavaScript that looks something like this:
I'm writing a Chrome extension that needs to alter a popular web app when
Writing htaccess that allows me to remove index.php from the URL can confuse search
Writing documentation in html requires some code examples. What to do with characters that
Writing a python program, and I came up with this error while using the
I'm writing a simple editor in an iframe, but having trouble registering the oninput

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.