检测远程网站是否可以构建

检测远程网站是否可以构建

本文介绍了检测远程网站是否可以构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检测远程网站是否允许站在iframe下。
例如,如果网站不想在iframe(amazon.com项目详情页面)下显示内容,或者如果他们有框架破坏代码(walmart.com),我不想打扰这些网站。我只是想打开新窗口,对于其他人(比如wikipedia.com)我想在iframe下显示内容。

I want to detect if remote website allows to stand under iframe or not.For example if website does not want to show content under iframe (amazon.com item details page) or if they have frame busting code (walmart.com) I do not want to bother with these websites. I just want to open new window, for others (like wikipedia.com) I want to show content under iframe.

我的问题是有没有办法检测是否网站会接受是否属于iframe?

My question is that is there any way to detect if website will accept being under iframe or not?

推荐答案

我认为没有这种方式。您无法检查从其他域加载的iframe内容 - 即使您可以,它仍然取决于网站所有者决定放在哪里。如果某人将设计他们的'iframed'内容与原始内容完全相同 - 但所有页面的文本以ROT13编码,例如?

I think there's no such way. You cannot inspect a content of iframe loaded from another domain - and even if you could, it still will be dependent of what exactly the owner of the site decided to put in there. What if someone will design their 'iframed' content exactly the same way as original - but with all page's text encoded in ROT13, for example?

这篇关于检测远程网站是否可以构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 01:28