例如,網頁加載的JavaScript文件,這樣head標籤內:如何從cleint端的網頁攔截Javascript/CSS文件請求,並加載替代文件insted?
<script src="http://www.somedomain.com/js/somejsfile.js"></script>
或CSS文件:
<link rel="stylesheet" type="text/css"
href="http://www.somedomain.com/somecssfile.css">
我想實現的是,在加載頁面本身,而不是原來的http://www.somedomain.com/js/somejsfile.js
它應該加載另一個文件http://www.anotherdomain.com/js/anotherfile.js
可能會通過一些自定義的Firefox/Chrome(最好不是IE)擴展或其他東西。
提示:
這也可以用來替補多jQuery庫等從本地源,而不是遠程谷歌*託管文件加載。
這是你自己的地方用我承擔?我建議查找Greasemonkey併爲它寫一個腳本.https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/ – KingCronus
@KingCronus:GreaseMonkey不是所有問題的答案。它不會在這裏工作,GreaseMonkey只會在腳本加載後纔會激活。 –
有效點,我沒有想到這一點。 – KingCronus