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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:03:05+00:00 2026-05-12T00:03:05+00:00

The scene : I’m writing an embeddable widget. It takes the form of a

  • 0

The scene: I’m writing an embeddable widget. It takes the form of a <script> tag, which builds an iframe containing everything it needs to display. The iframe has no src, and the script writes to it with theIframe.contentWindow.document.write(). This keeps the widget contained, and keeps element ids and script from conflicting with the page on which the widget is embedded.

The trick: The widget has to be able to change its size. To do this, it sets its containing iframe’s style.height. This requires access to the outer page’s DOM. In Firefox and IE, this is allowed, because the iframe’s document and the outer document are considered to share an origin.

The twist: In Safari, however, the two documents are considered not to share an origin. The inner document is considered to be at about:blank, while the outer document is clearly using a different protocol and “domain” (if blank can be considered the domain).

The question: How can I build an iframe programmatically whose document Safari/WebKit will consider to have the same origin as the document of the window creating it?


Edit: After further experimentation, I can’t find a way to programmatically create an iframe whose location is not about:blank regardless of whether I change its contents.

If I create the frame with document.createElement(), give it a src which points to a real HTML resource on the same origin called “foo.html”, and document.body.appendChild() it, Safari’s console shows the element as expected in the DOM, but the contents of the page do not appear, and the document is listed in the sidebar as “about:blank”.

If I include the HTML for the iframe directly in the page, the contents of foo.html appear, and “foo.html” appears in the sidebar.

If I insert the HTML using document.write(), I get the same result as with document.body.appendChild().

Both programmatic versions work in Firefox.

  • 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-12T00:03:05+00:00Added an answer on May 12, 2026 at 12:03 am

    Aha. This seems to be a bug in WebKit. When an iframe is created programmatically, its src attribute is ignored. Instead, the frame defaults to about:blank and must be directed to a URL to point elsewhere. For example:

    theIframe.contentWindow.location = theIframe.src
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Scene: A (smallish) Form hosting a UserControl. The Plot: Whenever UserControl raises a
Setting the scene: My asp.net web application carries a version number which is incremented
Hi guys heres the scene - I'm building a web application which basically creates
I've created a scene which has many cubes, spheres, etc, in it, and have
i created a scene in 3d max which is pretty huge, the thing is
I have an OpenGL scene in which the user can rotate the camera. I
I have a level scene in my game in which I am selecting the
For building a scene graph a decision needs to be made between using TFixedPoint
I'm writing a simple scene graph to hold some objects so I can control
I have a class Scene, which has_one Photo, and Photo belongs_to Scene. I want

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.