Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Re-enable javascript dialog [closed]

I am rewriting this question because I think it deserves to be answered. The reason given for why it was closed is as follows: "Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself."

The specific problem: When calling too many alerts/confirms in JavaScript (as might happen from a bug in your code), the browser will eventually ask you if you want to ignore further alerts. Once you ignore these alerts, how do you get the browser to re-enable those alerts?

Valid code to reproduce the problem:

<script>while(true) alert("Stop Me");</script>

I'll go on to answer the question if it's re-opened...

Here is Zane's original question:

When developing in javascript, I sometimes will end up in a situation where I generate alerts in an endless loop. Silly but true.

To get out of this endless loop, I either need to close the browser (normally using chrome) or disable dialogs for the page. But I don't know how to re-enable dialogs without restarting browser.

Is there a simple way to re-enable the dialogs? Surprisingly, I didn't get anything useful when googling for it.

Zane

like image 630
Zane Avatar asked Nov 15 '13 14:11

Zane


2 Answers

Close tab > Ctrl+Shift+T (reopen last closed tab)

Works every time.

like image 112
tkore Avatar answered Oct 04 '22 01:10

tkore


Let me present an alternative answer from what you're asking, as I think alerts() are a rather time consuming way to debug, especially when you're using Chrome as your development platform.

Developing with the aid of various console functions you can get a more streamlined debugging workflow set into place.

I understand that alerts() are sometimes good to stop the execution to read your code - although console has commands to cater for this as well:

debugger;

for( var x = 0; x < 10; x++ ) {
   if ( x == 5 ) 
       debugger;  //Console opens, press F8 to resume or F10 to step into.
}

enter image description here

Console.warn and Console.log

   for( var y = 10; y > 0; y-- ) {
      if ( y == 4 ) 
         console.warn( 'Oh no!', y );
      else
         console.log( 'Normal:', y );
   } 

enter image description here

like image 30
MackieeE Avatar answered Oct 03 '22 23:10

MackieeE