2013-10-27 4 views
2

이후에 사용자가 다시 버튼을 누르면 document.write()가 페이지로드시 호출되는 경우 다시 역사에 파이어 폭스를 다시) document.write를을 (실행 현재 페이지에 그를 받아 너무도 다른 뒤로 버튼 그는각 document.write() 이후에 새로운 히스토리를 작성하는 Firefox에 대한 회피 방법 각 document.write() 새 history entrie가 작성된 후 Firefox에서

간단한 해결 방법을 원하는 경우 그에게 도움이 안 걸릴 누르면이 또 다른 역사를 만들어 :

function onbeforeunload(e) 
{ 
    setTimeout(function() { window.history.go(-2); }, 0); 
} 
window.addEventListener("beforeunload", onbeforeunload, true); 

그러나 사용자가 링크를 클릭하거나 주소를 입력하여 주소창으로 이동하게하지 않으므로 Firefox를 수정하는 다른 방법이 있습니까?

더 좋은 방법 대신 onpopstate 이벤트를 사용하는 것입니다하지만 document.write를()

후 파이어 폭스에서 작동하지 않습니다없고, document.write를()가 여기에 사용해야합니다. document.write을 실행하는

+0

같은 $('html').replaceWith(pageContent)하거나 브라우저 파이어 폭스의 경우 역사를 조작으로 ... - 작동하지 않았다 다른 해결 방법을주의하는 것이 흥미 롭

, ...) 대신'document.write (...)'를 사용한다. – Abrixas2

+0

여기서 document.write를 사용해야합니다. – Owyn

답변

0

사용 document.open 변경 이력을 유지하면서 :

<script> 
    document.open("text/html",document.write("foo")); 
</script> 

참조

+0

gilad barner, 나에게도 효과가 없었지만, 당신에게 도움이 된 것에 대한 당신의 의견은 어디에 있습니까? –

+0

나에게 도움이 안된다. * *는 * document.open ("text/html", "replace") 대신에'document.open()'을 사용한다. -) –

3

사용 document.open("text/html", "replace") 대신 단지 document.open().

매력처럼 작동합니다. 가능한 해결책은 DOM 기능의 사용 (`getElementById`,`appendChild` 것

+0

이것은 나를 위해 일했다 :'document.open ("text/html", "replace"); document.write (html); document.close();' – 01AutoMonkey