[問題] JS frame跨domain取變數時
http://211.20.224.10:8881/test.php
按下去GOOGLE再按下取參數即為跨網域取變數
主要的程式碼
alert("start");
if (typeof(parent.frames['bottom'])!= 'undefined' &&
typeof(parent.frames['bottom'].sysGotoLabel) != 'undefined'){
alert(parent.frames['bottom'].sysGotoLabel);
}
alert("end");
以上測試網頁在firefox 並不會去alert end會因為跨網域取JS變數,
直接出現一個亂碼的錯誤於firebug就死在那邊了
可是IE會跳過會alert出end
目前我暫時解法是用try...catch將這段包起來...程式會繼續執行
不過firebug還是會跳錯誤
請問有什麼其他比較好的方法嗎
我有想過去判斷是不是domain 可是firefox好像一拿變數就直接跳錯誤...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 211.20.224.10
→
05/06 16:36, , 1F
05/06 16:36, 1F
→
05/06 17:02, , 2F
05/06 17:02, 2F
→
05/06 17:03, , 3F
05/06 17:03, 3F
→
05/12 23:06, , 4F
05/12 23:06, 4F
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章