Reputation: 2683
On my website can create something like presentation
and one functions of site is Add object - website
. After click, new iframe
is created with typed website URL
. But some websites, for example google and facebook, are unable to be insterted via iframe. So I need to create prevention to check, if is site able to be in the iframe
, when not, alert will be displayed.
Before posting this question as duplicate:
I need to use only JavaScript (or jQuery), my website works on Java, so don't post me answers with PHP codes or other languages!!!
Upvotes: 0
Views: 115
Reputation: 1776
Did you tried jQuery error method.
$( "<iframe-id>" ).error(function() {
alert("invalid url")
})
Upvotes: 1