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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:52:39+00:00 2026-05-30T19:52:39+00:00

we have a site with Iframes pointing to dynamic Urls (by user input). In

  • 0

we have a site with Iframes pointing to dynamic Urls (by user input).
In case of a 404/500 or any other error, we want to replace the Iframe source with a different user friendly other URL.
For this we can use with the onerror event to identify when the dynamic websites have problems. (then, in case of problem replace the iframe url)
This works also for cross domain urls, however there might be a case where the dynamic url might be malicious and such security issue rises where the malicious code will execute in the same frame ,same domain of our website.

Is this assumption correct?
Is there any solution for this?
Any other suggestions?

Thanks,
Tal

  • 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-30T19:52:40+00:00Added an answer on May 30, 2026 at 7:52 pm

    we have a site with Iframes pointing to dynamic Urls (by user input). In case of a 404/500 or any other error, we want to replace the Iframe source with a different user friendly other URL.

    So it sounds like you are making a sort of "browser in a web page."

    For this we can use with the onerror event to identify when the dynamic websites have problems. (then, in case of problem replace the iframe url)

    Yes, except not many things have onerror events. I assume you are aware of this from your comments on other answers. If I understand you right, you’re talking about using a dummy script element to load the URL first (as a script, even though it’s not really a script), and determine whether the URL is valid using the using onload/onerror handlers for the script element (onerror will not fire on a script error, only a network error).

    This works also for cross domain urls, however there might be a case where the dynamic url might be malicious and such security issue rises where the malicious code will execute in the same frame ,same domain of our website.

    Is this assumption correct?

    Your assumption is correct. If the URL actually does contain a script, it will execute in the user’s browser in the same domain as your site.

    Is there any solution for this?

    A simple workaround might be to do something like what jsfiddle.net does… have a separate subdomain act as a "firewall" between the third-party content and your real domain.

    Any other suggestions?

    The script preload hack is really just that, a hack. It misappropriates the script tag and makes needless requests. I would probably look into using XHR to fire off a HEAD request instead, or doing some light server-side proxying.

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

Sidebar

Related Questions

For example I have site http://localhost/site In IIS I set that 404 error causes
I have a site that displays other sites through an iframe on certain pages.
I have a site in rails and want to have site-wide settings. One part
I want to have site wide default settings for all jQuery validation uses on
I have an application which has an iframe pointing to a specific web site.
I reference objects (images, scripts, iframes, etc) from other websites. Sometimes, the other site
I have created an iframe which contains the label, powered by MyWebsite.site The iframe
I have an IFRAME on my web site. It's about 300px wide by 200px
I have a page P1 loading from site S1 which contains an iframe. That
So I have site list on certain pages that basically just have links to

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.