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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:42:13+00:00 2026-05-13T18:42:13+00:00

For my own purposes ( cough lazy-loading an ad script), I am overwriting the

  • 0

For my own purposes (cough lazy-loading an ad script), I am overwriting the document.write function in order to buffer the script’s output, writing it to a div, and restoring the native document.write when I am done.

The pseudo-code looks something like this:

  • save off native code document.write
  • redefine document.write
  • eval and buffer output of script
  • when script is done, write buffer to
  • restore native document.write

The problem happens in the bolded step – one of the lines in the ad script creates an iframe, and calls

frame.document.write

Stepping through Firebug, I have verified that this document.write is the native JS code and not my overwritten version.

Is there a way to overwrite document.write for ALL windows and frames? This is a scoping issue, but I’m not sure how to force my document.write to prevail.

  • 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-13T18:42:13+00:00Added an answer on May 13, 2026 at 6:42 pm

    Every window is a unique and precious snowflake, and as such is brought into this world with certain gifts from the Creator. Among those gifts are its own “window” and “document” objects, as fresh and pure as the crystal-clear primeval oceans at the Dawn of Time.

    Similarly, all of the basic Javascript “classes” (Function, Array, RegExp, etc) are all “clean”. That’s why when you load a page into an iframe, if that page has its own local scripts that rely on (say) jQuery it has to import its own copy of the library.

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

Sidebar

Related Questions

For training purposes, I am trying to write my own smartpointer, imitating std::shared_ptr .
I'm adapting this Django management command for my own purposes. The script is a
I was generally considering writing a protocol for my own purposes over TCP and
As almost every programmer, I'm writing my own PHP framework for educational purposes. And
I'm writing my own MVC framework in PHP, just for learning purposes. It wasn't
Im creating my own blog managing app in rails (for experimental purposes).... What would
I am writing my own Firebird database browser using the ibpp library. Is there
I am writing my own programming language just for the fun of it. Currently
I'm currently persisting filenames in a sqlite database for my own purposes. Whenever I
I am creating an RSS reader purely for my own educational purposes and am

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.