如何提取HTML文档中的javascript链接? [英] How to extract javascript links in an HTML document?
本文介绍了如何提取HTML文档中的javascript链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为一个使用网站上很多JavaScript的网站编写一个小型Webspider:
I am writing a small webspider for a website which uses a lot of javascript for links:
<htmlTag onclick="someFunction();">Click here</htmlTag>
函数如下:
function someFunction() {
var _url;
...
// _url constructed, maybe with reference to a value in the HTML doc
// and/or a value passed as argument(s) to this function
...
window.location.href = _url;
}
在服务器端评估此功能的最佳方法是什么,以便我可以构造_url的值?
What is the best way of evaluating this function server-side so I can construct the value for _url?
推荐答案
您还可以使用 env.js 和 rhino 来实际评估html中的JavaScript并检测更改手动触发click事件后,将其定位到位置对象.
You could also use env.js and rhino to actually evaluate the JavaScript in the html and detect changes to the location object after manually firing a click event.
这篇关于如何提取HTML文档中的javascript链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文