Chrome under Window.alert Disable this page and then display this dialog box issue

Source: Internet
Author: User

Write in front

The recent Chinese New Year, and then big and small leaders have gone home, it will not let us these small chores in this play, OK.

The leader will have nothing to do until he goes home. Let's do the little chores, things are the original chrome incompatible features now you do it compatible.

This sentence is very light and light, this can be my own. Let's take a little problem to illustrate.

The root of the problem

The problem that the testers measured

I look at the code carefully, the original code is written like this (this is the ASP code).

 Response.Write   <script language=
       JavaScript   " >  "    window.alert ('   " & STRMSG & "    "  Response.Write   " </SCRIPT>   

I just can't figure it out. There is only one window.alert, but the "Disable this page and Show dialog box" will appear under Chrome. Show this "Prohibit this page and Display dialog box", show this is not a problem, the key is the test preface the check box to point, the result of the subsequent operation of this page no longer frame, perhaps in our developer's view, this is not a problem at all, but, The test just says that this is not compatible with the bug, you have to change well.

Well, you're going to have to work for the job.

Then I just thought of replacing window.alert in the form of plugins.

Replace Window.alert with plugins

People think clearly a javascript built-in functions, now replaced with plug-ins to achieve a lot of trouble, I have to put the relevant CSS and JS are quoted, I have to rewrite the relevant methods, and then become the following code

 <  link  href  = "Css/dialogdefault.css"   rel  = "stylesheet"  />  <  script  src  = "Js/artdialog.js"   type  = "Text/javascript"  ></ script  >  
 function   Myalertdialog (msg) {Art.dialo G ({title:  ' Friendly hints '  ' 20em                '  function   () {                Window.location.href  = ' corpairwaysauditlist.asp ' ;        }, Focus:  true  }]    }); }
    " <script language= "" JavaScript "" > "     "Myalertdialog ('" ");          " "</script>"      

Fortunately Artdialog has a callback function, because Window.alert is the kind of blocking process, so only put the subsequent code in the callback function will not appear to modify the code caused by the new problem.

Colleague mm help think of the trick

I have a big leader is a good-hearted Lord, also very approachable, this is not my problem, to find his help. He called his hand a front-end master of mm think of a way. How should I describe it, for example. Originally, your code was like this.

        function Mydemo () {                       alert (' DDD ');            Alert (' DDD ');            Alert (' DDD ');            Alert (' DDD ');            Alert (' DDD ');        }        Mydemo ();

Then my front-end master of the beautiful mm think of the method is this

        (function  () {            var  timer;             function (TXT) {                cleartimeout (timer);                 = SetTimeout (function () {Newalert (TXT)}, [+]}            ;        }) ();

This seems to solve my problem, but originally can pop 5 times ddd, but the beautiful mm code after the only pop up once ddd, the subsequent dialog box can not come out.

Last Words

It says a bunch of crap, in fact, it's imperative to keep the browser compatible (just say that the leader is deliberately looking for something to make me do just grandstanding).

There is no better way to do it than to have the great God help think about the solution (actually, as a developer, I don't think it's a bug right now)

If any big God knows the best plan, please do not hesitate to enlighten me!




If you think this article is still hard, please Lau the lower right corner of the recommendation . The little woman thanked her here. ^_^

Chrome under Window.alert Disable this page and then display this dialog box issue

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.