特定页面集的Javascript页面加载延迟 [英] Javascript page load delay of specific set of pages

查看:51
本文介绍了特定页面集的Javascript页面加载延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用一个小润滑脂脚本来延迟一组特定的网页.基本上,如果要加载的网站是一组页面的一部分,那么我想延迟页面加载的时间.例如如果正在加载的页面是"http://www.a.com/"、http://www.a.com/b"等,那么我想将加载延迟30秒.

I want to delay a specific set of webpages using a small greasemonkey script. Basically, if the website being loaded is part of a set of pages, then I want to delay the time the page takes to load. e.g. if the page being loaded is "http://www.a.com/","http://www.a.com/b", etc. then I want to delay the load by 30 secs.

推荐答案

假定Dushara的评论正确:

Assuming that Dushara's comment is correct:

"请参见 xkcd.com/862 ,了解发布者的需求.(将鼠标悬停在图片上看看原因).实际上,我在搜寻完全相同的东西时发现了这个问题."

"See xkcd.com/862 for what the poster wants. (Hover the mouse over the image to see the reasoning). In fact, I found this question while googling for exactly the same thing."

然后在Greasemonkey中是不可能的.原因是GM在页面加载后触发(任何慢速图片或AJAX调用除外).因此,用户将看到该页面,然后该页面将空白闪烁30秒...但是,只有在快速的眼球看到太多之后,该页面才会显示. ;)

更新:现在可以在Greasemonkey中实现(带有@run-at document-start指令-2011年8月添加).有关示例,请参见此答案.

Update: This is now possible in Greasemonkey (with the @run-at document-start directive -- Added August 2011). See this answer for an example.

请注意,XKCD的创建者使用良好的老式意志力来实现其简单的30秒延迟".来自他的博客条目:

Note that XKCD's creator uses good, old-fashioned willpower to implement his "simple 30-second delay". From his blog entry:

很多人问我我用来实现今天漫画替代文本限制的系统.
...
我规定,一旦完成任何任务或对它感到无聊,就必须关闭计算机电源."

"Lots of people have asked me for the system I used to implement the restriction in the alt-text of today’s comic.
...
I made it a rule that as soon as I finished any task, or got bored with it, I had to power off my computer."

另请参见:浏览器扩展程序(或其他软件)可延迟页面加载" -现在具有指向人们为此创建的适当扩展的链接.

See also: "Browser extension (or other software) to delay page load" -- which now has links to proper extensions that people created for this.

这篇关于特定页面集的Javascript页面加载延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆