iframe src跨域 [英] Iframe src cross domain

查看:347
本文介绍了iframe src跨域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在iframe中显示另一个网站。我不需要访问我将要显示的这个网站上的任何内容。这违反了跨域政策吗?如果是这样,代理会绕过这个吗?

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?

我尝试了一个简单的iframe,其src设置为 http://google.com 作为测试,看起来这确实违反了此政策。如果我不需要在显示的网页上访问任何内容,我该如何绕过这个。

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.

推荐答案

不,你可以访问任何网站通过iFrame。
违反政策的是试图以任何方式操纵网站,现代浏览器不会让你操纵它。

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确实允许你通过iFrame获取他们的网站,然而,他们使用代码来突破框架,因此您不会通过iFrame查看他们的网站,而是会被重定向到google.com

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

这篇关于iframe src跨域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆