DOMNodeInserted or hashchange

Posted by jakey on Stack Overflow See other posts from Stack Overflow or by jakey
Published on 2010-12-26T21:43:19Z Indexed on 2010/12/26 21:54 UTC
Read the original article Hit count: 139

Filed under:
|
|

I am trying to write a JavaScript script that is "overlayed" on top of a Facebook page. It uses DOMContentLoaded to detect when content is loaded, then adds some extra stuff in. However, because Facebook doesn't actually "reload" the page when going to a new page (it just uses AJAX), the DOMContentLoaded handler doesn't run again, even though there is new stuff to look through.

Anyway, to detect the change, I thought about using onhashchange since Facebook used to change the page's hash, but in Firefox 4 (I need to support Firefox 3 and later with this, but no other browsers), Facebook doesn't change the hash anymore and in pre-Firefox 3.6 there is no onhashchange.

I thought about using DOMNodeInserted, but would that really slow down the page? (I really can't have any slowdowns in this script.)

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about facebook