How to wait until a web page is loaded with javascript?

后端 未结 3 954
野的像风
野的像风 2020-12-11 20:20

I want to change between two pages in html with javascript, but when I change with window.location, the code that is after this sentence continues executing.

3条回答
  •  忘掉有多难
    2020-12-11 20:47

    You can use jQuery document.ready or you can create custom bind like this one. In case you use jQuery.

       $(document).ready(function() {
            window.location = 'page.html';
        });
    

提交回复
热议问题