[英]How to disable <meta> tag in firefox?
如果沒有類似於Chrome的條件(如上面的評論),那么你總是可以檢查服務器端的用戶代理並添加所需的meta
標記(如果它是chrome)。
檢測瀏覽器不是一個好主意 。 雖然舊版本的jQuery支持$.browser()
但沒有廣泛的建議。
因此,嘗試找出問題的根本原因並使其與瀏覽器兼容。
更新:
我用這個答案創造了一個小提琴,
var isOpera = !!window.opera || navigator.userAgent.indexOf('Opera') >= 0;
// Opera 8.0+ (UA detection to detect Blink/v8-powered Opera)
var isFirefox = typeof InstallTrigger !== 'undefined'; // Firefox 1.0+
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
// At least Safari 3+: "[object HTMLElementConstructor]"
var isChrome = !!window.chrome; // Chrome 1+
var isIE = /*@cc_on!@*/false; // At least IE6
document.write('isFirefox: ' + isFirefox + '<br>');
document.write('isChrome: ' + isChrome + '<br>');
document.write('isSafari: ' + isSafari + '<br>');
document.write('isOpera: ' + isOpera + '<br>');
document.write('isIE: ' + isIE + '<br>');
使用上面的瀏覽器檢測代碼,我添加了這個
if (isFirefox) {
$('meta[http-equiv=Refresh]').remove();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.