SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast magnam's Avatar
    Join Date
    Jun 2006
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to stop javascript alert within iframe

    I am displaying a web page within an iframe on my own site. The problem is that this web page has an alert on body onload.

    Is there any way I can supress the alert via my iframe onload attribute?

    I've tried things like iframe onload="void();" and abort();

    Thx

  2. #2
    SitePoint Enthusiast magnam's Avatar
    Join Date
    Jun 2006
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The alert only comes up in firefox, not IE. The page has a popup onload and onunload. Basicaly when the page loads and when you attempt to close your browser it will ask you if you're sure. I want to supress both of these.

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    If it is from your domain then the easiest way is to remove the code from the page in the iframe (or change it so it doesn't run if the page loads in an iframe).

    If it is from some other domain then cross domain security means there is no way for javaScript in your page to have any effect on it.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •