The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Trying to understand this snippet Reply To: Trying to understand this snippet


A bit more insight, wasn’t the first time I came across that snippet. But now realise it has nothing to do with code injection prevention but filtering out the correct anchors. I was preoccupied with the aforementioned because I just read that getting the window.location.hash and using it in jQuery can easily create a vulnerability.

Hmm… apparently this.hash is quicker :