I have entered code into the developer console here on StackOverflow to test some code that shows an alert();
on focus and switched between tabs. Then I clicked the message away but it immediately returned because the window.onfocus
event seemed to have turned into an infinite loop. I was writing an answer for which I wanted to test the code and that's why I didn't want to reload the page as all progress would be lost. So I clicked the checkbox "Block future requests from stackexchange.com" that was displayed when the message popped up the second time and got rid of the message by doing so.
Now I have a problem: If I now want to cause an alert();
, I get no alert and the return value is undefined
, without any error.
I then searched the internet on how to unblock js alerts in firefox but the only thing I found that came even close to what I need was a ton of tutorials on how to unblock WebPush requests.
Is there a way to unblock alert();
s? If it involves about:config or manually editing config files, no problem.
I am on Linux Mint, so Windows paths to those files won't help me. But you can include them for Windows users who might read this and have the same problem.
This is the code I entered:
window.onfocus = function() { alert('example'); return; };
CodePudding user response:
Restarting Firefox helps, but for me a reboot of my whole laptop was also necessary (maybe because I didn't restart either Firefox or my computer within the last two weeks?).
Thanks to @Felix Kling for the help, you can find his comment here: Firefox: unblock JavaScript alerts on specific website