开发者

rewriting Javascript before it's loaded by the browser

I need to arbitrarily rewrite Javascript code, client-side, before it's loaded by the browser. I would like to handle script tags as well as referenced .js files. Dynamically generated script tags are not a goal. My client is running a proprietary system, so this only needs to work with IE for now (IE6+). I've read up on MIME-filte开发者_运维知识库ring, but I don't think that would take care of static script tags, just .js files.


What is the use case for this? It sounds like an approach to be avoided if at all possible. You will lose any ability to cache javascript for one thing.

Can you give an example of the kinds of rewriting you want to do?


Ouch, nasty. Would it be possible to configure users' browser with a custom proxy which can parse and rewrite the javascript? This could be pushed out with group policy (if the browsers are not already configured with proxies)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜