我在做一個簡單的重定向來強制用戶使用HTTPS而不是HTTP。我知道有很多縮短newUrl變量的方法,但事實是這個循環在IE8中持續,但在FF中起作用。該網頁的其餘部分甚至沒有加載....但我得到所需的URL,我希望....有誰知道爲什麼window.location在IE8上運行不同?Javascript重定向循環只在IE8上
<script language="JavaScript">
if (location.protocol = "http:") {
var newUrl = "https://";
newUrl += location.hostname;
newUrl += ":64040";
newUrl += location.pathname;
newUrl += location.search;
// redirect
window.top.location = newUrl;
}
</script>
我不知道這會在任何瀏覽器都工作過。 – putvande
https://github.com/SublimeLinter/SublimeLinter – tenub
建設性評論... putvande! – user2891480