How can I call a function in the parent, from iframe (child); when i do it in following way, browser says
"Permission denied for <http://localhost>
to get property Window.func from <http://localhost:8080>.
[Break On This Error] parent.window.func(); "
call in iframe
parent.window.func()
the function in the parent
function func(){
alert("test开发者_开发知识库")
};
For security reasons, you cannot interact with a frame containing a webpage in a different domain or port.
For some reason, you are doing a cross-domain request, which breaks the same origin policy. You can only access other windows if they are from the same domain as the window in question.
http://localhost
is a different domain to http://localhost:8080
; the different ports make the request forbidden.
精彩评论