cowboy / jquery-hashchange

This jQuery plugin enables very basic bookmarkable #hash history via a cross-browser HTML5 window.onhashchange event.
http://benalman.com/projects/jquery-hashchange-plugin/
GNU General Public License v2.0
1.22k stars 258 forks source link

Fixes error when embedding the script into a page. #18

Closed mohamedmansour closed 5 years ago

mohamedmansour commented 12 years ago

This script works well when including it into an external file, but it fails when embedding it in the same file. This fixes it by always escaping it, which will work in embedded and external documents.

The reason why it fails is because when you embed this script into the same page with "", browsers will treat that element as a closing script tag causing the rest of the code to be treated as text.

It is good practice to always escape "" tags when using them in JavaScript.