x-frame-bypass
x-frame-bypass copied to clipboard
Detection only & open in new tab
Hi,
I've just found your code and must say this is a very clever solution. However there are some caveats which you should mention like: images, fonts & other external requests won't load.
So I think the best solution would be to simply DETECT if the URL which is restricted from being shown inside iframes, then in the iframe window simply generate a simple button which reads "CLICK HERE TO OPEN IN A NEW TAB" instead of proxying the request.
That would be great as an additional functionality to your class.
Can you give an example URL which cannot load its assets, provided that it starts with https:// (no mixed content)?
Sure. Try with https://www.youtube.com
This is due to AJAX in an IFrame being blocked by CORS. It would be necessary to proxy XHR too. Try loading https://www.youtube.com/?disable_polymer=1 instead.
@niutech What does the disable_polymer do?
@E3V3A As the name shows, it disables the latest redesign using Polymer, which loads web components dynamically. Try appending &disable_polymer=1 for video URLs as well, e.g. https://www.youtube.com/watch?v=dp8PhLsUcFE&disable_polymer=1 or use the embed URLs in regular iframes: https://www.youtube.com/embed/dp8PhLsUcFE
@niutech Yeah, I tried that already. Didn't work for the two cases above...
For a single video, a standard iframe should work.
Those 2 has iframe disabled, which is why I am here...