简体   繁体   English

没有跨源策略的浏览器访问 iframe

[英]Browser without cross origin policy to access iframes

I know iterations of this question have been answered a lot, but I couldn't find a valid answer among them我知道这个问题的迭代已经得到了很多回答,但我在其中找不到有效的答案


I have an iframe and I want to play with it using javascript to test stuff.我有一个 iframe,我想使用 javascript 来测试它。 It's for personal testing only, I don't want it public.它仅用于个人测试,我不希望它公开。

I want a browser that allows me to do this without getting "Uncaught DOMException: Blocked a frame with origin X from accessing a cross-origin frame.我想要一个浏览器,它允许我执行此操作而不会收到“未捕获的 DOMException:阻止了具有原始 X 的框架访问跨源框架。

I've tried:我试过了:

  • to open chrome with "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" --disable-web-security --user-data-dir=~/chromeTemp使用“C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe”打开 chrome --disable-web-security --user-data-dir=~/chromeTemp
  • to disable all security in Firefox禁用 Firefox 中的所有安全性
  • to install CORS disabling plugins.安装 CORS 禁用插件。

For some reason, the browsers still throw that error.出于某种原因,浏览器仍然会抛出该错误。

I know I can write a script in another environment like node to load and manipulate the page, but I want to do it in a browser我知道我可以在其他环境(如 node)中编写脚本来加载和操作页面,但我想在浏览器中执行此操作

So is there a browser that has no cross-domain security, or no security at all, but supports html5 for test purposes?那么有没有一种浏览器没有跨域安全,或者根本没有安全性,但支持html5用于测试目的?

In recent versions of Chrome (77+), in addition to --disable-web-security , you've have to add the --disable-site-isolation-trials flag to access cross origin frames.在最新版本的 Chrome (77+) 中,除了--disable-web-security ,您还必须添加--disable-site-isolation-trials标志才能访问跨源框架。

The command line to start Chrome will be something like启动 Chrome 的命令行类似于

chrome.exe --disable-web-security --user-data-dir="C:\Users\Administrator\chrome-profile" --disable-site-isolation-trials

Source: https://www.chromium.org/Home/chromium-security/site-isolation来源: https : //www.chromium.org/Home/chromium-security/site-isolation

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

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