所以記錄下來備忘。
先增加一檢查瀏覽器版本的函數
//檢查瀏覽器版本
function chkBrowserisIE11() {
var userAgent = navigator.userAgent.toLowerCase();
var rMsie = /(msie\s|trident.*rv:)([\w.]+)/;
var match = rMsie.exec(userAgent);
if(match != null){
var vNumber=match[2].split(".")[0];
if (vNumber >= 11){
return true;
}
return false;
}
return false;
}
function chkBrowserisIE11() {
var userAgent = navigator.userAgent.toLowerCase();
var rMsie = /(msie\s|trident.*rv:)([\w.]+)/;
var match = rMsie.exec(userAgent);
if(match != null){
var vNumber=match[2].split(".")[0];
if (vNumber >= 11){
return true;
}
return false;
}
return false;
}
檢查如果是ie11,則取用window.parent.opener,否則無法正確回傳值。
var flag = chkBrowserisIE11();
var pe;
if (flag) {
pe = window.parent.opener;
}
else {
pe = parent;
}
var pe;
if (flag) {
pe = window.parent.opener;
}
else {
pe = parent;
}
沒有留言:
張貼留言