Safari JavaScript Console Not Executing JS Or Showing Output On Certain Pages

Viewed 3108

I've encountered a Safari-specific JS issue in a page I'm locally developing, so I need to use the Safari Web Inspector.

In Safari Version 13.1.1, when I open the inspector and select Develop > Show JavaScript Console and start entering JavaScript, I don't get any output and the JavaScript is not executed (e.g. an alert does not fire).

picture of 2+2;, alert('okay!');, var myvar = 'foo'; in blue with no output

On any other page, the safari JS console works just fine for me. Here's an example of normal behavior, on stackoverflow.com:

picture of 2+2; with 4 output

Note: the Safari JS console on other locally developed pages are working just fine.

What could possibly be causing this?

3 Answers

As other users mentioned, opening the page in a new tab fixes this, but you can also just close the Javascript console (clicking the 'x' in the console window) and re-open it.

Less than ideal, but if you reopen the file on a new tab, the new console works.

I get this error. often, this is because I occasionally repeat something way too many times, so that it just stops executing the console, I believe to prioritize other code. my fix is to re-open the page, and even though re-loading sounds like it works, it doesn't always.

Related