How do I disable the access denied message when trying to do cross scripting into an iframe?

自作多情 提交于 2020-01-15 07:04:12

问题


I have an iframe that points to a website ie.

<iframe src='http://www.fish.com/' id='fish'>

I have a html on my local pc that tries to click a button in the iframe:

alert ( $('#fish').contents().find('#myButton').length );

I have enabled cross site scripting in my browser and lowered security to the max. I still get access denied errors. I have tried in IE6, IE8, and Firefox. How can I remove this restriction? I am trying to test something, and understand the risks etc.

Here is an example:

http://jsfiddle.net/RSbja/

Using the exact code above.


回答1:


Firefox needs the option signed.applets.codebase_principal_support set to true (about:config).

Chrome needs to get started with --disable-web-security

IE needs the option allow cross-domain access (...) under Extras -> Security


Those options will disable the security check for cross-domain access on XHR objects and iframes.



来源:https://stackoverflow.com/questions/6293418/how-do-i-disable-the-access-denied-message-when-trying-to-do-cross-scripting-int

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!