javascript - Can I use js to cancel the alert window?
为情所困
为情所困 2017-06-12 09:20:43
0
2
839

Recently I wanted to operate the company's business system (web page) directly in emacs
So I used elisp to write a websocket server, and then I wrote a client in the business webpage using Grease Monkey Script. After connecting, I call a function in emacs to send instructions to the client. After receiving the instructions, the client executes the corresponding instructions. DOM operation, but after the operation is completed, the web page will pop up the alert window, and you must click OK.
Can I use js to control the alert? Let alert not be displayed or press Enter automatically after displaying?
thank you all

为情所困
为情所困

reply all(2)
小葫芦

The

alert() function actually calls the window.alert() function, so it is very simple to stop it from being displayed. Just add a line directly to your script

window.alert=function(){}

That’s it.
Accident or not? Violent or not?

扔个三星炸死你

If the pop-up window pops up by the alert() method of native Javascript, it cannot be closed through JS code. It is recommended to use a custom pop-up window to implement the function, such as using x0popup to replace the pop-up window function. We hope to adopt it!

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template