最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - What is the opposite of javascript window.stop() - Stack Overflow

programmeradmin1浏览0评论

Once I've executed window.stop(), how can I resume default actions?

I need to make toggle/switch function, that once fired will run window.stop(), and with second run will recover window actions disabled by window.stop().

Once I've executed window.stop(), how can I resume default actions?

I need to make toggle/switch function, that once fired will run window.stop(), and with second run will recover window actions disabled by window.stop().

Share Improve this question asked Sep 21, 2013 at 17:02 BlueMarkBlueMark 9724 gold badges24 silver badges41 bronze badges 7
  • 2 stop stops any current downloads. So what do you expect to happen when you "unstop"? – Dave Commented Sep 21, 2013 at 17:05
  • 1 window.location.reload(); – Dave Commented Sep 21, 2013 at 17:10
  • 1 I don't think it is possible – Andrey M. Commented Sep 21, 2013 at 20:24
  • 2 You could implement a limited form yourself by looping through all images on the page and toggling their URL if they haven't fully loaded, but that may not work in all browsers. I certainly don't know any inbuilt method. Remember that stopping and pausing are very different ideas. – Dave Commented Sep 21, 2013 at 21:13
  • 1 window.stop() will stop all request currently executing unless the resource your are trying to restart knows how to resume i.e based on some form of session data,calling window.location.reload() will restart the request a fresh assuming the request has not been cached by the browser.To better answer your question you need to define what you mean by "recover". – mujib ishola Commented Sep 24, 2013 at 7:01
 |  Show 2 more ments

1 Answer 1

Reset to default 5

I misunderstood before how window.stop() works.

I was wrong, there are no any "direct inbuilt" javascript method to reload ONLY THESE ELEMENTS stopped by window.stop(), so by this meaning it's impossible.

However, if it's needed, we can:

  • loop through each element on the site by our own function
  • cut website in sections, and load them one by one with ajax, so we will have to reload only specific sections --but I think either one of these it's too plex to implement to be worthy

So, to "pause website for moment" window.stop() it's not good choice.

发布评论

评论列表(0)

  1. 暂无评论