开发者

How to automatically open a new/unvisited link on a webpage?

I am using firefox and continuously refreshing a webpage to check if a new link/post has came on the webpage. Currently I am using reload every and refreshing a webpage and when a new link comes I click on that but I need to automate this task. While searching on google I have found that I can use Greasemonkey to achieve this. Don't know how exactly to do this. What I have thought is I will make already present links to webpage as visited i.e. click on already present links, then start reload every and make greasemonkey click on 开发者_开发知识库unvisited links. I am not sure if this can be achieved. Need your suggestions on this or if there is any other way to do this.


JavaScript can no longer tell if a link was visited1, so you (your script) will have to track this separately. So the task breaks down to:

  1. Monitor the page for new links.

  2. Track whether the links have been "clicked". This will probably have to use persistent storage, depending on details that the question didn't provide.

  3. "Click" or follow the links. In a new tab/window or the same window?

Each one of these items is a question by itself. And specific details of the page, and what you are trying to do make a huge difference in practice.

I might write a general answer later, but I recommend that you ask questions on each part -- break the task into palatable chunks.

Be exact on what you are trying to accomplish, and link to the target page. If you cannot link for some reason, save the page to a file and post that file at pastebin.com, then link to that.



1 Such a capability is considered a security hole.


You could write a greasemonkey script that reloads the window after 30 seconds. In your script, you would put:

window.onload = function () {
    setTimeout(window.location.reload, 30000);
}

Assuming that greasemonkey will let you execute javascript

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜