javascript iframe 中的 parent.location.reload 不工作 IE
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7545633/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
parent.location.reload in iframe not working IE
提问by Joko Nardi
I need refresh in parent site / refresh my browser when I click testing. I have source index.php:
单击测试时,我需要在父站点中刷新/刷新浏览器。我有源 index.php:
<iframe id="test" src="/careertest/q.php"></iframe>
and in q.php:
在 q.php 中:
<a href="#" onclick="parent.location.reload(true);">testing</a>
Its working in FF LAtest version + Chrome but not working in IE 9.
它适用于 FF 最新版本 + Chrome,但不适用于 IE 9。
He said "script70 :Permission denied."
他说“script70:权限被拒绝。”
I am already change
我已经变了
parent.location.reload(true)
with:
和:
window.parent.location =window.parent.location.href;
or
或者
document.domain=document.location.href;
but still not working...
但仍然无法正常工作...
采纳答案by Chamika Sandamal
use this function
使用这个功能
function reloadParentPage() {
var selfUrl = unescape(parent.window.location.pathname);
parent.location.reload(true);
parent.window.location.replace(selfUrl);
parent.window.location.href = selfUrl;
}
回答by Zachary
Try adding "window" after parent.
尝试在父级之后添加“窗口”。
parent.window.location.reload(true);
回答by Uday Hiwarale
This works in IE, Chrome and Firefox and may be others
这适用于 IE、Chrome 和 Firefox,也可能适用于其他人
window.top.location.reload();