elegant alert()

Display a non-blocking alert box at the top right corner, and automatically close after a few seconds. Click on the alert box will close it immediately and copy the alert message to clipboard.

< Feedback on elegant alert()

Câu hỏi/Bình luận

§
Posted: 10-05-2023

你好,http://www.jrskan.com/ 此网站在页面打开的时候就会调用confirm弹窗(跟alert类似),我用下面的代码重写confirm方法试图阻止,但是它会先弹窗后才会执行我的脚本,请问这种怎么处理,烦请指教。

(function() {
'use strict';

window.confirm = null
})();

Evan TsengTác giả
§
Posted: 10-05-2023

在標頭宣告
// @run-at document-start

這行會要求油猴儘快注入你的程式碼
若沒宣告何時 run,預設是等到 HTML DOM 全建立完成,網頁進入待機時才會注入


但某些網頁的寫法是在 body 之前就有內嵌 inline javascript,這種情況下就算有宣告 run-at document-start ,它自帶的內嵌程式碼也會比油猴更早執行

Post reply

Đăng nhập để bình luận