I'm generating a bunch of iframes dynamically that load random websites, and I was wondering if there would be a way to programmatically check if iframing for a website were blocked so I can fall back to a thumbnail of the site instead. Is there a way to do this, and if so, how? (JQuery is preferred.)
If the remote url is not https, or forwards to a non-https url, it will be blocked (by the browser) from displaying in the iframe. If the remote site is indeed https, but contains at least one resource served by http (instead of https), the browser will block the iframe due to mixed content.
In short, to check if a page is in an iframe, you need to compare the object's location with the window object's parent location. If they are equal, then the page is not in an iframe; otherwise, a page is in an iframe.
If a user has javascript disabled, iframes will work. An iframe tag has attributes “height” and “width,” which allows the designer great latitude with dimensions and format like 300×250 , 728×90 depending on the Ad size. Iframe tag can appear anywhere on the page and several iframes can be added if wished to.
A very quick and dirty method to bypass some iframing blocks would be to append the url with a free defferer, like http://anonym.to/?site.com, though I don't really recommend this in legitamite practice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With