Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

alert not bubbling from iframe

I have an iframe that has an alert function and a console.log function.

I am able to see the output from the console.log, however the alert function is not bubbling up (never gets fired in a way that is visible).

I tried disabling web security on chromium, as well as disabling popup-blocking via command line flags both did not have the desired effect. How can I allow popups to bubble through without changing the code in the iframe?

Note: This is the chromium web driver running in Atom.

like image 459
zmanc Avatar asked Aug 31 '26 20:08

zmanc


1 Answers

I created two jsfiddles, the first https://jsfiddle.net/c9mougua/6/ has an <iframe> linking to another jsfiddle https://jsfiddle.net/ypptc1f8/3/ which has the alert() and this is working correctly.

Make sure you are calling your alert correctly and also if you have the javascript on the first page trying to call it in the Iframe that will not work either. The alert() needs to be called inside the actual second page and not the <iframe> itself.

first page

<body>
<iframe src="https://jsfiddle.net/ypptc1f8/3/">

</iframe>
</body>

second page

<body onload="test()">

</body>
    <script>
        function test(){
        alert("Inside IFrame");
        }
    </script>
like image 193
Adam Buchanan Smith Avatar answered Sep 03 '26 09:09

Adam Buchanan Smith



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!