[ js ] redirect page JavaScript
各位版上的先進早安!
小弟被這問題困擾了好幾天了
想問一個關於 parent/child 頁面轉址的問題
問題的描述如下:
Parent Window A: 使用者一開始使用的視窗 (on Domain X)
Popout Child Window B: 使用者在 A 視窗點擊按鈕而產生的子視窗 (on Domain Y)
今天在 B 視窗處理完一些事情之後,想要轉址原來的 A 視窗 並且將 B 視窗自動關閉
程式碼如下:
window.onload = function() {
setTimeout(function() {
var redirect_url = document.getElementById('rediurl').value;
if (window.opener) {
window.opener.location.href = redirect_url;
window.close();
} else {
window.location.href = redirect_url;
}
}, 3000);
};
http://jsfiddle.net/uXFJb/1/
奇怪的是這段程式在非 IE 以外的瀏覽器都支援
包括 Firefox Chrome Opera Safari 偏偏 IE 就是不支援
雖然也很想不支援 IE 但 IE 使用率還是有一定的市場
所以想請問一下版上的朋友們,有什麼樣的方法可以解決IE的問題嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.37.103.66
※ 編輯: chonhan 來自: 114.37.103.66 (07/02 08:40)
推
07/02 11:34, , 1F
07/02 11:34, 1F
推
07/02 22:38, , 2F
07/02 22:38, 2F
→
07/03 05:18, , 3F
07/03 05:18, 3F
→
07/03 05:19, , 4F
07/03 05:19, 4F
→
07/03 14:10, , 5F
07/03 14:10, 5F
→
07/03 14:10, , 6F
07/03 14:10, 6F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):