Click here to Skip to main content
13,196,730 members (59,672 online)
Rate this:
Please Sign up or sign in to vote.
Hello everyone. I am simply trying to build a Chrome extension which waits for a webpage to load then, gets access to its DOM model an finally manages to modify it by injecting scripts at certain parts of the page. The extension is meant to be a page_action since i am planning to run it on certain websites. I don't need a pop_up or anything. Just an extension that would run in the background without the user having to push any buttons or click on any pop ups.

The current problem I am facing right now is that, the functions are called BEFORE the DOM is completely loaded. Is there a way for me to wait till the DOM is completely loaded then, perform my modifications?

Thank you in advance!
Posted 7-Feb-13 3:46am
Updated 11-Feb-13 0:40am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I finally managed to reach a solution which fits my case. I added the following line of code to my .js file.
$(window).bind('hashchange', fooBar);

This way, everytime the URL of the page changes, the function fooBar is called. This event is only triggered after the page's DOM is completely loaded.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.171019.1 | Last Updated 11 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100