0

as I can redirect to a page when this can not be shown in an iframe, for example google, if you do not load the iframe redirect google directly.

<script type="text/javascript">       
function redirect(iframe)
{
window.location = iframe.src;
}
</script>
<iframe src="http://www.google.com" onerror="redirect(this)"></iframe>
  • Possible duplicate of [Catch error if iframe src fails to load . Error :-"Refused to display 'http://www.google.co.in/' in a frame.."](http://stackoverflow.com/questions/15273042/catch-error-if-iframe-src-fails-to-load-error-refused-to-display-http-ww) – Soviut Aug 25 '16 at 06:37

1 Answers1

3

for security reasons (cross-browser functionality), You can't access elements in an iframe from a different domain with JQuery. you don't have access to any properties within an iframe.iframe probably isn't the best to rely on.

Aida Bigonah
  • 197
  • 10