简体   繁体   中英

Javascript confirm makes Safari freeze with HTML from remote server

Safari does not show a confirm window with code served from a remote host. After onclick Safari freezes without any message in the javascript console. The same code does work when it is served from a local host and the code works in Chrome, whether served from remote host or local host.

Does anyone have any idea?

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
    confirm("Press a button!");
}
</script>

Version: Safari version 12.0.1, MacOS Mojave version 10.14.1

I ended up restarting my MacBook (which I rarely do) and guess what...problem solved. The HTML confirm in Safari is not a problem anymore.

I did not change any code on my remote host in the meanwhile. And it really surprises me that the HTML/Javascript code from one remote host (w3schools) works and the same code served from the other remote host (my remote host) does not work. After the restart of my computer (not just the browser) the confirm popup works like it did before.

I don't exactly know when I last updated the MacBook due to auto-update preferences. I guess restarting the computer from time to time isn't that bad.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM