Now many user browsers have turned on the pop-up window filtering function, indeed, pop-up windows are now generally become pop-up ads, so it is necessary to filter. However, as a developer, we should consider whether the user has turned on this feature, we will improve the program based on whether or not to open this feature, JavaScript can easily determine whether the client browser enabled window filter, the code is as follows:
The code is as follows |
Copy Code |
<script language= "JavaScript" > function Testopenwin (schtext) { if (!schtext== ') { var toolswin=window.open (Schtext, "", ""); if (toolswin==null) { Window.alert ("has opened the window filter function!") NN to run this program correctly, temporarily turn off this feature! ") ; } } } </script> |
You can use the following code to verify that the user has turned off the window filter function.
The code is as follows |
Copy Code |
<form name= "Thisform" > <select name= "Sitelist" onchange= Testopenwin (document.thisform.sitelist.options[ Document.thisform.sitelist.selectedindex].value) "><option value=" "Selected>= Please select =</option>< Option value= "" "> Source Enthusiasts </option><option value=" http://www.111cn.net "> Baidu search </option><option Value= "Http://qq.111cn.net" >csdn</option><option value= "http://mingzi.111cn.net" > Technology online </option > </select> </form> |
If the above code is run, there is no prompt at the top of the browsing end, indicating that the user has banned the window filter.