Click here to Skip to main content
Rate this: bad
good
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 4:46am
Daroosh659
Edited 11-Feb-13 1:40am
v3

1 solution

Rate this: bad
good
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.
  Permalink  

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

  Print Answers RSS
0 BillWoodruff 260
1 Mathew Soji 244
2 Afzaal Ahmad Zeeshan 232
3 OriginalGriff 231
4 Maciej Los 230
0 OriginalGriff 6,419
1 Sergey Alexandrovich Kryukov 6,008
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 4,070


Advertise | Privacy | Mobile
Web01 | 2.8.1411019.1 | Last Updated 11 Feb 2013
Copyright © CodeProject, 1999-2014
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