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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:05:13+00:00 2026-06-10T20:05:13+00:00

I am setting the source of an iframe to an html string as shown

  • 0

I am setting the source of an iframe to an html string as shown below to have it execute a string of html that I have stored in memory.

window.sHTML = html;
iframe.src = 'javascript:parent.sHTML';

The html string includes javascript code like this:

window.onerror = function(a,b,c) {
  console.log(a);
  console.log(b);
  console.log(c)
  return true;
}

When are error occurs in the iframe it logs “Script Error”, “”, “0” rather than giving me the actual error information.

I understand that this can happen when the iframe in question is cross domain: Cryptic "Script Error." reported in Javascript in Chrome and Firefox

However, the iframe is not cross domain, it is just something I created dynamically. Is there any way to make window.onerror treat it as a non-cross domain iframe so that I can access the proper error information from window.onerror?

  • 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-10T20:05:15+00:00Added an answer on June 10, 2026 at 8:05 pm

    If you need to dynamically populate iframe content with an HTML string, document.write would probably work:

    var iframe = document.createElement('iframe');
    
    document.body.appendChild(iframe);
    
    iframe.contentDocument.open();
    iframe.contentDocument.write(yourHTMLString);
    iframe.contentDocument.close();
    

    reference

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

Sidebar

Related Questions

I have a page with an iframe that has no source on page load
For the images in my application, I have been setting the source property of
I'm setting up Source Control for a one man software project. It's important that
I am displaying image by setting the source of an Image element directly to
When setting up a UITableView's data source, I'd be interested to get views on
I'm running into difficulty setting up a new project into source control. I've imported
I am having trouble with setting up the open source library JFreeChart for creating
Setting up a project structure; I am thinking is it better to have somewhat
I have a source flat file with values such as 24.209991, but they need
When setting up a source control repository for a Flex Builder workspace, what do

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.