js檢測(cè)客戶(hù)端不是firefox則提示下載
更新時(shí)間:2007年04月07日 00:00:00 作者:
var hasIE_phone_home = 0;
// This function does the actual browser detection
function writeCookie(name, value, hours)
{
var expire = "";
if(hours != null)
{
expire = new Date((new Date()).getTime() + hours * 360000000);
expire = "; expires=" + expire.toGMTString();
}
document.cookie = name + "=" + escape(value) + expire;
}
// Example:
// alert( readCookie("myCookie") );
function readCookie(name)
{
var cookieValue = "";
var search = name + "=";
if(document.cookie.length > 0)
{
offset = document.cookie.indexOf(search);
if (offset != -1)
{
offset += search.length;
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
cookieValue = unescape(document.cookie.substring(offset, end))
}
}
return cookieValue;
}
function hasIE_hasIE() {
var ua = navigator.userAgent.toLowerCase();
return ((ua.indexOf('msie') != -1) && (ua.indexOf('opera') == -1) &&
(ua.indexOf('webtv') == -1) &&
(location.href.indexOf('seenIEPage') == -1));
}
function hasIE_showOnlyLayer(whichLayer)
{
if (document.getElementById)
{
var style2 = document.getElementById(whichLayer);
}
else if (document.all)
{
var style2 = document.all[whichLayer];
}
else if (document.layers)
{
var style2 = document.layers[whichLayer];
}
var body = document.getElementsByTagName('body');
body[0].innerHTML = style2.innerHTML;
}
function hasIE_showLayer(whichLayer)
{
if (document.getElementById)
{
var style2 = document.getElementById(whichLayer).style;
style2.display = "block";
}
else if (document.all)
{
var style2 = document.all[whichLayer].style;
style2.display = "block";
}
else if (document.layers)
{
var style2 = document.layers[whichLayer].style;
style2.display = "block";
}
}
function hasIE_moveAd(adid) {
if (document.getElementById)
{
var ad = document.getElementById('hasIE_ad');
var adloc = document.getElementById(adid);
}
else if (document.all)
{
var ad = document.all['hasIE_ad'];
var adloc = document.all[adid];
}
else if (document.layers)
{
var ad = document.layers['hasIE_ad'];
var adloc = document.layers[adid];
}
adloc.innerHTML = ad.innerHTML;
}
// Hides and shows sections of the page based on whether or not it's
// running in IE
function hasIE_hideAndShow() {
if (hasIE_hasIE()) {
hasIE_showLayer("hasIE_level1");
if (hasIE_phone_home == 1)
hasIE_phoneHome('getIE_pingimage1');
} else {
if (hasIE_phone_home == 1)
hasIE_phoneHome('getIE_pingimage0');
}
}
function hasIE_phoneHome(image) {
if (document.getElementById)
{
var img = document.getElementById(image);
}
else if (document.all)
{
var img = document.all[image];
}
else if (document.layers)
{
var img = document.layers[image];
}
//img.setAttribute('src','http://getunder50.com/ping.php?host='+location.host);
}
function hasIE_ContinueWithoutFF() {
if (location.href.indexOf('?') != -1)
location.href += '&seenIEPage=1';
else
location.href += '?seenIEPage=1';
}
function closediv(i) {
writeCookie("status","showed24",240);
document.getElementById(i).style.display='none';
}
document.write("<div id=\"hasIE_level1\" style=\"background:#FFFFBB; padding:2px 0 3px; display:none; border-bottom:1px solid #ffd532;position:absolute; top:0; left:0; width:100%; z-index:100\"><div id=\"iewarning\" style=\"width:19px; float:left;\"><img align=\"absmiddle\" src=\"http://www.shiy.net/firefox/warning.gif\" border=\"0\" /></div><div id=\"closeimg\" style=\"width:19px; float:right;\"><a href=\"javascript:closediv('hasIE_level1');\" title=\"關(guān)閉提示\"><img src=\"http://chabaoo.cn/images/close1.gif\" align=\"absmiddle\" border=\"0\" /></a></div><div style=\" margin-top:4px;marign-left:4px;font-size:12px;color:#092E20\">系統(tǒng)提示:發(fā)現(xiàn)您正在使用IE瀏覽器,強(qiáng)烈推薦您在 Windows 操作系統(tǒng)中使用最安全的瀏覽器: <a href=\"http://chabaoo.cn/adsense/adsense.htm\" title=\"FireFox火狐瀏覽器2.0下載\" target=\"_blank\"><font color=\"#ee0000\">FireFox火狐瀏覽器2.0,點(diǎn)擊下載</a></font> !</div></div><div style=\"clear:both\"></div>");
if(document.referrer.indexOf("hao123")==-1 && document.referrer.indexOf("hao222")==-1)
{
if(readCookie("status") != "showed24")
{
hasIE_hideAndShow();
}
}
// This function does the actual browser detection
function writeCookie(name, value, hours)
{
var expire = "";
if(hours != null)
{
expire = new Date((new Date()).getTime() + hours * 360000000);
expire = "; expires=" + expire.toGMTString();
}
document.cookie = name + "=" + escape(value) + expire;
}
// Example:
// alert( readCookie("myCookie") );
function readCookie(name)
{
var cookieValue = "";
var search = name + "=";
if(document.cookie.length > 0)
{
offset = document.cookie.indexOf(search);
if (offset != -1)
{
offset += search.length;
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
cookieValue = unescape(document.cookie.substring(offset, end))
}
}
return cookieValue;
}
function hasIE_hasIE() {
var ua = navigator.userAgent.toLowerCase();
return ((ua.indexOf('msie') != -1) && (ua.indexOf('opera') == -1) &&
(ua.indexOf('webtv') == -1) &&
(location.href.indexOf('seenIEPage') == -1));
}
function hasIE_showOnlyLayer(whichLayer)
{
if (document.getElementById)
{
var style2 = document.getElementById(whichLayer);
}
else if (document.all)
{
var style2 = document.all[whichLayer];
}
else if (document.layers)
{
var style2 = document.layers[whichLayer];
}
var body = document.getElementsByTagName('body');
body[0].innerHTML = style2.innerHTML;
}
function hasIE_showLayer(whichLayer)
{
if (document.getElementById)
{
var style2 = document.getElementById(whichLayer).style;
style2.display = "block";
}
else if (document.all)
{
var style2 = document.all[whichLayer].style;
style2.display = "block";
}
else if (document.layers)
{
var style2 = document.layers[whichLayer].style;
style2.display = "block";
}
}
function hasIE_moveAd(adid) {
if (document.getElementById)
{
var ad = document.getElementById('hasIE_ad');
var adloc = document.getElementById(adid);
}
else if (document.all)
{
var ad = document.all['hasIE_ad'];
var adloc = document.all[adid];
}
else if (document.layers)
{
var ad = document.layers['hasIE_ad'];
var adloc = document.layers[adid];
}
adloc.innerHTML = ad.innerHTML;
}
// Hides and shows sections of the page based on whether or not it's
// running in IE
function hasIE_hideAndShow() {
if (hasIE_hasIE()) {
hasIE_showLayer("hasIE_level1");
if (hasIE_phone_home == 1)
hasIE_phoneHome('getIE_pingimage1');
} else {
if (hasIE_phone_home == 1)
hasIE_phoneHome('getIE_pingimage0');
}
}
function hasIE_phoneHome(image) {
if (document.getElementById)
{
var img = document.getElementById(image);
}
else if (document.all)
{
var img = document.all[image];
}
else if (document.layers)
{
var img = document.layers[image];
}
//img.setAttribute('src','http://getunder50.com/ping.php?host='+location.host);
}
function hasIE_ContinueWithoutFF() {
if (location.href.indexOf('?') != -1)
location.href += '&seenIEPage=1';
else
location.href += '?seenIEPage=1';
}
function closediv(i) {
writeCookie("status","showed24",240);
document.getElementById(i).style.display='none';
}
document.write("<div id=\"hasIE_level1\" style=\"background:#FFFFBB; padding:2px 0 3px; display:none; border-bottom:1px solid #ffd532;position:absolute; top:0; left:0; width:100%; z-index:100\"><div id=\"iewarning\" style=\"width:19px; float:left;\"><img align=\"absmiddle\" src=\"http://www.shiy.net/firefox/warning.gif\" border=\"0\" /></div><div id=\"closeimg\" style=\"width:19px; float:right;\"><a href=\"javascript:closediv('hasIE_level1');\" title=\"關(guān)閉提示\"><img src=\"http://chabaoo.cn/images/close1.gif\" align=\"absmiddle\" border=\"0\" /></a></div><div style=\" margin-top:4px;marign-left:4px;font-size:12px;color:#092E20\">系統(tǒng)提示:發(fā)現(xiàn)您正在使用IE瀏覽器,強(qiáng)烈推薦您在 Windows 操作系統(tǒng)中使用最安全的瀏覽器: <a href=\"http://chabaoo.cn/adsense/adsense.htm\" title=\"FireFox火狐瀏覽器2.0下載\" target=\"_blank\"><font color=\"#ee0000\">FireFox火狐瀏覽器2.0,點(diǎn)擊下載</a></font> !</div></div><div style=\"clear:both\"></div>");
if(document.referrer.indexOf("hao123")==-1 && document.referrer.indexOf("hao222")==-1)
{
if(readCookie("status") != "showed24")
{
hasIE_hideAndShow();
}
}
相關(guān)文章
js+canvas實(shí)現(xiàn)動(dòng)態(tài)吃豆人效果
本文主要介紹了js+canvas實(shí)現(xiàn)動(dòng)態(tài)吃豆人效果的實(shí)例。具有很好的參考價(jià)值。下面跟著小編一起來(lái)看下吧2017-03-03JavaScript中的單引號(hào)和雙引號(hào)報(bào)錯(cuò)的解決方法
數(shù)據(jù)中夾雜單引號(hào)(')或者雙引號(hào)("),這種語(yǔ)句往往會(huì)造成JavaScript報(bào)錯(cuò)。對(duì)此一般采用/'或者/"的解決2014-09-09JavaScript設(shè)計(jì)模式經(jīng)典之命令模式
命令模式(Command)的定義是:用來(lái)對(duì)方法調(diào)用進(jìn)行參數(shù)化處理和傳送,經(jīng)過(guò)這樣處理過(guò)的方法調(diào)用可以在任何需要的時(shí)候執(zhí)行。接下來(lái)通過(guò)本文給大家介紹JavaScript設(shè)計(jì)模式經(jīng)典之命令模式,需要的朋友參考下2016-02-02Bootstrap警告(Alerts)的實(shí)現(xiàn)方法
這篇文章主要為大家詳細(xì)介紹了Bootstrap警告(Alerts)的實(shí)現(xiàn)方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-03-03javascript window.onerror事件學(xué)習(xí)新收獲
javascript window.onerror事件學(xué)習(xí)新收獲...2007-11-11js實(shí)現(xiàn)base64、url和blob之間相互轉(zhuǎn)換的三種方式
Blob對(duì)象表示一個(gè)不可變、原始數(shù)據(jù)的類(lèi)文件對(duì)象,Blob表示的不一定是JavaScript原生格式的數(shù)據(jù),下面這篇文章主要給大家介紹了關(guān)于js實(shí)現(xiàn)base64、url和blob之間相互轉(zhuǎn)換的三種方式,需要的朋友可以參考下2023-04-04