Can I control the web browser's loading icon?

拜拜、爱过 提交于 2019-12-23 20:26:36

问题


Can I control the browser's loading state with JavaScript?

I.e., I want the browser to display its native "loading" animation, not my own loading icon in the page, but the one that appears instead of the favicon while the browser is loading the page.


回答1:


You can make the browser load some page (in an invisible iframe for instance)




回答2:


I once built a page which would get into an infinite loop of making AJAX requests as soon as the page loaded. It would make an ajax request, update something on the page, and then repeat the request, etc..

I had about 4-6 of these loops fired off right at the page load which would each retrieve and update the status of one 'auction' on the homepage.

It had the effect of the page always remaining in that 'loading' state, i.e the progress bar always showing and the loading animation showing in the address bar. The client didn't want that so I put an interval of 2 seconds between each request, however it might work for you.



来源:https://stackoverflow.com/questions/694858/can-i-control-the-web-browsers-loading-icon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!