开发者

stopping javascript from getting executed

开发者 https://www.devze.com 2023-01-23 01:22 出处:网络
is it possible to prevent further execution of javascript? I include some javascript scripts with php in a header (with echo \'\'), but there are coming some other scripts later in the page which i c

is it possible to prevent further execution of javascript?

I include some javascript scripts with php in a header (with echo ''), but there are coming some other scripts later in the page which i can not always control, so it could be that my before included (with ) mootools javascript get later overwritten by another included mootools (which then possible is an older version, or is not complete etc.)

so is there a way that I can stop the js at one point so that later js code will not be executed?

kind of like the die(); function in php, but without that it sto开发者_如何学Cps the page from being loaded.


doesnt really exist. but you can put everything into a function and "return;" any given time to exit the function which would stop the execution of the rest of the code within the function.

super simple example in standard JS:

function init() {
    if(something happens) {
         return;
    }
}
init();

in terms of stopping the browser from executing other scripts within the page - not possible.

0

精彩评论

暂无评论...
验证码 换一张
取 消