Iframe src cross domain

2019-06-01 20:48发布

问题:

I need to display another website in an iframe. I don't need to access anything on this website I'll be displaying. Is this in violation of the cross domain policy? If so, would a proxy bypass this?

I tried a simply iframe with its src set to http://google.com as a test, and it looks like this does violate this policy. How can I bypass this if I don't need to access anything on the displayed webpage.

回答1:

No, you can access any site through an iFrame. What is against the policy is trying to manipulate the site in any way and modern browsers won't let you manipulate it anyways.

Google does allow you to get their site through an iFrame, however, they're using code to "break out of frames", so instead of viewing their site through an iFrame, you'll just be redirected to google.com



回答2:

Ah, I see now that its only the test page I used, google, that forbids this. Other sites are OK.