[英]Prevent execute second block on IE v11
當我在 IE v11 事件上執行此事件時,我有一個條件,第一個塊為真不執行,因為我的第二個塊有錯誤,我的問題是如何取消此行為我的意思是在這種情況下我想顯示警報和如果我是 IE v11,就不要再執行了。
if (window.navigator.userAgent.indexOf('Trident/') > 0) {
alert('this browser is not supported');
return
} else {
var se = `some here`; // <- this is not supported on EI v11
console.log('here',se);
}
嗯,這是一個骯臟的解決方案,我強烈不建議使用它。 但是你可以像這樣使用eval
:
if (window.navigator.userAgent.indexOf('Trident/') > 0) {
alert('this browser is not supported');
return;
} else {
eval('var se = `some here`'); // <- this is not supported on EI v11
console.log('here',se);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.