2010-12-08 2 views
1

IE가 페이지를 업데이트하지 못하게하려면 어떻게합니까? 나는 ... 그것을 업로드하지 말아야 같은 페이지입니다 이후로는, SF & C. FF처럼 행동 할IE가 페이지를 새로 고치지 못하게 방지 - iframe _top

부모 페이지 :

<!DOCTYPE html> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
</head> 
<body> 
    <p>This is the parent page. I don't want this page to reload in IE when the link in the iframe is clicked, since it break our javascript. I only want the "hash" to change.</p> 
    <iframe src="http://example.com/iframepage.html"></iframe> 
</body> 
</html> 

iframe이 페이지 :

<!DOCTYPE html> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
</head> 
<body> 
    <p>This is the iframe page. The URL is the same as the parent page + anchorlink. When I klick this link in IE the page refresch and the javascript breaks. In FF, SF & C it doesn’t "refresh" page…</p> 
    <a href="http://www.example.com/test.html#test1" target="_top">test1</a> 
</body> 
</html> 
+0

죄송합니다. 게시 할 때 HTML이 사라집니다. 상위 페이지의 URL : http://www.example.com/test.html iframe에 링크 : a href = "http://www.example.com/test.html#test1"target = "_top"> test1 Hakan

답변

-1

이 코드를 모든 브라우저에서 사용해보십시오

var src = document.getElementById("mydiv").getAttribute("src"); 

if (navigator.appName == "Microsoft Internet Explorer") // ie iframe reload fix 
    document.getElementById("mydiv").setAttribute("src",""); 

$SQuery(mydiv).setAttribute("src",src); // this will not save it in history ;) 
관련 문제