防止iframe突围HTML 5 / JS [英] Prevent iframe breakout HTML 5 / JS

查看:106
本文介绍了防止iframe突围HTML 5 / JS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一款Chrome扩展程序,它模仿了Firefox的响应式设计视图的行为和功能。

I am currently working on a Chrome Extension that mimics the behaviour and functionality of Firefox's Responsive Design View.

一切都快完成了,一般来说效果不错。但是,如果可能的话,我遇到了一个我想避开的问题。我使用了 iframe ,用户可以根据大小等操作,但某些站点(包括StackOverflow)不允许将它们自己嵌入到框架中(有关安全性的警告)。

Everything is almost finished, and generally working well. However, I ran into a problem that I'd like to circumvent if possible. I have used an iframe that users can manipulate in terms of size, etc., but certain sites (including StackOverflow) do not allow themselves to be embedded in Frames (warning about security).

有没有人有解决方案来防止这种行为?我不想为此使用服务器端代码。删除iframe以支持另一种方法也很好。

Does anyone have a solution to prevent this behaviour? I do not want to use server-side code for this. Removing the iframe in favour of another method is also fine.

推荐答案

这种行为不能被重写,相当有意。如果一个网站声明它不想让自己嵌入到框架中,那么您无法做到这一点。

This behavior cannot be overridden, quite deliberately. If a site declares that it doesn't want to allow itself to be embedded in frames, there is precisely nothing you can do about it.

这篇关于防止iframe突围HTML 5 / JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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