Compatible Ie/firefox/opera/safari test page load complete script Ext.onready implementation _javascript skill

Source: Internet
Author: User
Copy Code code as follows:

<script type= "Text/javascript" ><!--
function Googleresize () {
Alert (1);
}
var ua=navigator.useragent.tolowercase ();
var isstrict=document.compatmode== "Css1compat",
Isopera=ua.indexof ("opera") >-1,
Issafari= (/webkit|khtml/). Test (UA),
Isie=ua.indexof ("MSIE") >-1,
Isie7=ua.indexof ("MSIE 7") >-1,
Isgecko=!issafari&&ua.indexof ("Gecko") >-1,
Isborderbox=isie&&!isstrict,
Iswindows= (Ua.indexof ("Windows")!=-1| | Ua.indexof ("Win32")!=-1),
Ismac= (Ua.indexof ("Macintosh")!=-1| | Ua.indexof ("Mac OS X")!=-1),
islinux= (Ua.indexof ("Linux")!=-1),
Issecure=window.location.href.tolowercase (). IndexOf ("https") ===0;
if (Isgecko | | isopera) {
Document.addeventlistener ("domcontentloaded", googleresize, false);
}else if (Isie) {
document.write ("<s" + ' cript id= "Ie-deferred-loader" defer= "defer" src= "/' + '/:" ></s ' + "cript>");
var defer = document.getElementById ("Ie-deferred-loader");
Defer.onreadystatechange = function () {
if (this.readystate = = "complete") {
Googleresize ();
}
};
}else if (Ext.issafari) {
Docreadyprocid = setinterval (function () {
var rs = document.readystate;
if (rs = = "complete") {
Googleresize ();
}
}, 10);
}else{
Window.onload=googleresize;
}
--></script>

The detection of IE is very interesting.
The above code, collation from ExtJS script, completely can replace ext.onready use.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.