Chrome extension: replace HTML before page loading

I have a question on how to change web pages with the Chrome extension.

After reading some information, I think the question is how to manipulate the DOM. Let's say I open www.stackoverflow with Chrome and want to replace the following line of code:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> 

and replace it with:

 <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script> 

My question is not that this is a smart thing, but how to do it?

+7
source share
1 answer

Try changing the line of the run_at file of the manifest file.

In the case of "document_start", files are inserted after any files from css, but before any other DOM is created or any other script is run.

http://code.google.com/chrome/extensions/content_scripts.html

+5
source

All Articles