简体   繁体   English

JavaScript框架

[英]Frames with JavaScript

如何使用JavaScript(JQuery)在框架中加载的网站(不在服务器中)进行操作?

I'm afraid you can't. 恐怕你做不到。 The Same Origin Policy prevents it. 同源起源策略阻止了这种情况。

The same origin policy prevents a document or script loaded from one origin from getting or setting properties of a document from another origin. 相同的来源策略可防止从一个来源加载的文档或脚本从另一个来源获取或设置文档的属性。 This policy dates all the way back to Netscape Navigator 2.0. 该策略可以追溯到Netscape Navigator 2.0。

the only conceivable workaround is to fetch the page through a proxy on your own web server, and do the JavaScript operations on that. 唯一可以想到的解决方法是通过您自己的Web服务器上的代理获取页面,然后在该服务器上执行JavaScript操作。 This, though, will destroy any relative links on the page, and is therefore usually not a workable approach without a lot of work (fixing relative links, etc.) 但是,这会破坏页面上的任何相对链接,因此,如果不进行大量工作(修复相对链接等),通常是不可行的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM