2011-07-12 27 views
1

沒有工作可以說我是在網站上的以下網頁:window.location的在IE8

http://example.com/account/ask

我試圖重定向到http://example.com/account/send?id=1上按一下按鈕。 以下語句在ie10,firefox和chrome中工作。但它不在ie8中工作。

<script language="javascript">window.location="account/send?id=<?=$qid; ?>";</script> 

如果瀏覽器IE8它是這樣的:

http://example.com/account/account/send?id=1

我怎樣才能解決這個問題?還是有更好的方法來做到這一點?

+1

您是否嘗試過使用'window.location.href'而不是'window.location'? – Pointy

回答

3
window.location="/account/send?id=<?=$qid; ?>"; 
1

似乎按照設計工作 - 實際上我很驚訝其他瀏覽器的做法不同。嘗試添加斜線使它成爲絕對URL:

<script type="text/javascript"> 
window.location="/account/send?id=<?=$qid; ?>"; 
</script> 
1
<script language="javascript">window.location.href = "account/send?id=<?=$qid; ?>";</script> 

使這一變化,它會在所有瀏覽器作品...

+0

這仍然不適合我? – ken

0

試試這個 window.event.returnValue = FALSE ; document.location.href =「account/send?id =」;