简体   繁体   中英

Capture text displayed on JavaScript Alert message

Presently I don't know whether it is possible or not?

One of my scenario I want to capture text which will displayed in alert box on third party websites by injecting my JavaScript file.

Is there any way to capture / retrieve text content displayed on alert message box using JavaScript?

You can try shadowing the alert function:

window.alert = (function(al) {
    return function(text) {
        // your stuff here...
        al(text);
    };
})(window.alert);

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