在一组html文件上运行一个javascript文件 [英] Run a javascript file on a set of html documents

查看:136
本文介绍了在一组html文件上运行一个javascript文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组本地磁盘上的html文件进行处理。我需要将每个文档文件加载为文档对象,并在其上运行一段JavaScript代码,并将结果存储在单独的文件中。我更喜欢这个从python,虽然我可以接受任何其他建议。我试图通过chrome和firefox的扩展来做到这一点,但浏览器不允许javascript访问磁盘上的文件。有没有解决方案?

I have a set of html documents on local disk to process. I need to load each document file as document object and run a piece of javascript code over it and store the result in a separate file. I would prefer to this from python though I'm open to any other suggestions too. I tried to do this through extensions in chrome and firefox but the browsers do not allow javascript to access files on disk. Is there a solution for this?

我尝试过python-spidermonkey,但只允许JavaScript执行。我似乎无法将html文件加载为文档对象。

I tried python-spidermonkey but it allows only javascript execution. I doesn't seem to be able to load the html file as document object.

推荐答案

我使用pyqt和webkit

I got it working with pyqt and webkit

这篇关于在一组html文件上运行一个javascript文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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