No prompts are displayed for closing the browser, such as traveling, flying, IE, and air network.

Source: Internet
Author: User

Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head id = "Head1" runat = "server">
<Title> </title>
</Head>
<Body>
<Script type = "text/javascript">
Function browserinfo (){
Var Browser_Name = navigator. appName;
Var Browser_Version = parseFloat (navigator. appVersion );
Var Browser_Agent = navigator. userAgent;
Var Actual_Version, Actual_Name;
Var is_IE = (Browser_Name = "Microsoft Internet Explorer"); // determines whether the browser is an Internet Explorer.
Var is_NN = (Browser_Name = "Netscape"); // determines whether the browser is a netscape Browser.
Var is_op = (Browser_Name = "Opera"); // determines whether the browser is operabrowser.
If (is_NN ){
// Upper 5.0 need to be process, lower 5.0 return directly
If (Browser_Version> = 5.0 ){
If (Browser_Agent.indexOf ("Netscape ")! =-1 ){
Var Split_Sign = Browser_Agent.lastIndexOf ("/");
Var Version = Browser_Agent.lastIndexOf ("");
Var Bname = Browser_Agent.substring (0, Split_Sign );
Var Split_sign2 = Bname. lastIndexOf ("");
Actual_Version = Browser_Agent.substring (Split_Sign + 1, Browser_Agent.length );
Actual_Name = Bname. substring (Split_sign2 + 1, Bname. length );
}
If (Browser_Agent.indexOf ("Firefox ")! =-1 ){
Var Split_Sign = Browser_Agent.lastIndexOf ("/");
Var Version = Browser_Agent.lastIndexOf ("");
Actual_Version = Browser_Agent.substring (Split_Sign + 1, Browser_Agent.length );
Actual_Name = Browser_Agent.substring (Version + 1, Split_Sign );
}
If (Browser_Agent.indexOf ("Safari ")! =-1 ){
If (Browser_Agent.indexOf ("Chrome ")! =-1 ){
Var Split_Sign = Browser_Agent.lastIndexOf ("");
Var Version = Browser_Agent.substring (0, Split_Sign );;
Var Split_Sign2 = Version. lastIndexOf ("/");
Var Bname = Version. lastIndexOf ("");
Actual_Version = Version. substring (Split_Sign2 + 1, Version. length );
Actual_Name = Version. substring (Bname + 1, Split_Sign2 );
}
Else {
Var Split_Sign = Browser_Agent.lastIndexOf ("/");
Var Version = Browser_Agent.substring (0, Split_Sign );;
Var Split_Sign2 = Version. lastIndexOf ("/");
Var Bname = Browser_Agent.lastIndexOf ("");
Actual_Version = Browser_Agent.substring (Split_Sign2 + 1, Bname );
Actual_Name = Browser_Agent.substring (Bname + 1, Split_Sign );
}
}
}
Else {
Actual_Version = Browser_Version;
Actual_Name = Browser_Name;
}
}
Else if (is_IE ){
Var Version_Start = Browser_Agent.indexOf ("MSIE ");
Var Version_End = Browser_Agent.indexOf (";", Version_Start );
Actual_Version = Browser_Agent.substring (Version_Start + 5, Version_End)
Actual_Name = Browser_Name;
If (Browser_Agent.indexOf ("Maxthon ")! =-1 | Browser_Agent.indexOf ("MAXTHON ")! =-1 ){
Var mv = Browser_Agent.lastIndexOf ("");
Var mv1 = Browser_Agent.substring (mv, Browser_Agent.length-1 );
Mv1 = "Roaming version:" + mv1;
Actual_Name + = "(Maxthon )";
Actual_Version + = mv1;
}
}
Else if (Browser_Agent.indexOf ("Opera ")! =-1 ){
Actual_Name = "Opera ";
Var tempstart = Browser_Agent.indexOf ("Opera ");
Var tempend = Browser_Agent.length;
Actual_Version = Browser_Version;
}
Else {
Actual_Name = "Unknown Navigator"
Actual_Version = "Unknown Version"
}
/*------------------------------------------------------------------------------
-- Your Can Create new properties of navigator (Acutal_Name and Actual_Version )--
-- Userage :--
-- 1, Call This Function .--
-- 2, use the property Like This: navigator. Actual_Name/navigator. Actual_Version ;--
------------------------------------------------------------------------------*/
Navigator. Actual_Name = Actual_Name;
Navigator. Actual_Version = Actual_Version;
/*---------------------------------------------------------------------------
-- Or Made this a Class .--
-- Userage :--
-- 1, Create a instance of this object like this: var browser = new browserinfo ;--
-- 2, user this instance: browser. Version/browser. Name ;--
---------------------------------------------------------------------------*/
This. Name = Actual_Name;
This. Version = Actual_Version;
}
Browserinfo ();
// Document. write ("your browser is:" + navigator. userAgent );
// Document. write ("<br> ");
// Document. write ("your browser is:" + navigator. Actual_Name + ", version:" + navigator. Actual_Version );
Function closewin (){
Var type = "";
Var ua = navigator. userAgent;
If (ua. indexOf ("MSIE")> = 0 ){
Type = "MSIE ";
If (navigator. Actual_Version = "7.0 "){
Type + = "7 ";
}
Else if (navigator. Actual_Version = "6.0 "){
Type + = "6 ";
}
}
Else if (ua. indexOf ("Firefox")> = 0 ){
Type = "FF ";
}
If (type = "MSIE6 "){
Window. opener = null;
Window. close ();
}
Else if (type = "MSIE7 "){
Window. open ('', '_ top ');
Window. top. close ();
}
Else if (type = "FF "){
Window. open ('', '_ parent ','');
Window. close ();
}
}
Window. onload = function (){
Closewin ();
}
</Script>
<Input type = "button" value = "the message" onclick = "closewin ()"/>
</Body>
</Html>

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.