if have iframe connects , displays data of local api
my problem iframe 403 error.
how can detect 403 can display alternetive message or page?
you use property iframe contentdocument
this example:
<html> <body> <iframe id="myframe" src="http:/www.stackoverflow.com/"></iframe> <p>click button change background color of document contained in iframe.</p> <p id="demo"></p> <button onclick="myfunction()">try it</button> <script> function myfunction() { var x = document.getelementbyid("myframe"); var y = (x.contentwindow || x.contentdocument); if (y.document)y = y.document; y.body.style.backgroundcolor = "red"; y.body.getelementsbytagname("h1")[0].innerhtml = "done"; //h1 because me, 404 error displayed <h1> tag. //but got access "dom" } </script> </body> </html>
Comments
Post a Comment