Skip to content

Commit 20265f9

Browse files
committed
Added $.fn.hashchange shortcut method, other minor tweaks.
1 parent 269e0ed commit 20265f9

22 files changed

+256
-67
lines changed

README.markdown

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# jQuery hashchange event #
22
[http://benalman.com/projects/jquery-hashchange-plugin/](http://benalman.com/projects/jquery-hashchange-plugin/)
33

4-
Version: 1.3pre, Last updated: 7/6/2010
4+
Version: 1.3pre, Last updated: 7/17/2010
55

66
This jQuery plugin enables very basic bookmarkable #hash history via a cross-browser window.onhashchange event.
77

@@ -13,10 +13,11 @@ Visit the [project page](http://benalman.com/projects/jquery-hashchange-plugin/)
1313

1414

1515
## Examples ##
16-
This working example, complete with fully commented code, illustrates one way
17-
in which this plugin can be used.
16+
These working examples, complete with fully commented code, illustrate a few
17+
ways in which this plugin can be used.
1818

1919
[http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/](http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/)
20+
[http://benalman.com/code/projects/jquery-hashchange/examples/document_domain/](http://benalman.com/code/projects/jquery-hashchange/examples/document_domain/)
2021

2122
## Support and Testing ##
2223
Information about what version or versions of jQuery this plugin has been
@@ -54,10 +55,13 @@ WebKit: Back Button in an Iframe
5455
Safari: Back Button from a different domain
5556
[http://benalman.com/code/projects/jquery-hashchange/examples/bug-safari-back-from-diff-domain/](http://benalman.com/code/projects/jquery-hashchange/examples/bug-safari-back-from-diff-domain/)
5657

58+
Also note that should a browser natively support the window.onhashchange
59+
event, but not report that it does, the fallback polling loop will be used.
60+
5761

5862
## Release History ##
5963

60-
1.3pre - (7/6/2010) Reorganized IE6/7 Iframe code to make it more "removable" for mobile development. Added jQuery.hashchangeDomain, jQuery.hashchangeIframeSrc properties and document-domain.html file to address access denied issues when setting document.domain in IE6/7. Note that when using jQuery.hashchangeIframeSrc, history won't be recorded in IE6/7 until the Iframe src file loads. Lowered the default jQuery.hashchangeDelay to 50 milliseconds. Added IE6/7 document.title support. Attempt to make Iframe as hidden as possible by using techniques from http://www.paciellogroup.com/blog/?p=604.
64+
1.3pre - (7/17/2010) Reorganized IE6/7 Iframe code to make it more "removable" for mobile development. Added jQuery.hashchangeDomain, jQuery.hashchangeIframeSrc properties and document-domain.html file to address access denied issues when setting document.domain in IE6/7. Note that when using jQuery.hashchangeIframeSrc, history won't be recorded in IE6/7 until the Iframe src file loads. Lowered the default jQuery.hashchangeDelay to 50 milliseconds. Added IE6/7 document.title support. Attempt to make Iframe as hidden as possible by using techniques from http://www.paciellogroup.com/blog/?p=604. Added support for the "shortcut" format $(window).hashchange( fn ) and $(window).hashchange() like jQuery does for built-in events.
6165
1.2 - (2/11/2010) Fixed a bug where coming back to a page using this plugin from a page on another domain would cause an error in Safari 4. Also, IE6/7 Iframe is now inserted after the body (this actually works), which prevents the page from scrolling when the event is first bound. Event can also now be bound before DOM ready, but it won't be usable before then in IE6/7.
6266
1.1 - (1/21/2010) Incorporated document.documentMode test to fix IE8 bug where browser version is incorrectly reported as 8.0, despite inclusion of the X-UA-Compatible IE=EmulateIE7 meta tag.
6367
1.0 - (1/9/2010) Initial Release. Broke out the jQuery BBQ event.special window.onhashchange functionality into a separate plugin for users who want just the basic event & back button support, without all the extra awesomeness that BBQ provides. This plugin will be included as part of jQuery BBQ, but also be available separately.

docs/files/jquery-ba-hashchange-js.html

Lines changed: 25 additions & 10 deletions
Large diffs are not rendered by default.

docs/index/Events.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
2222

2323

24-
<div id=Menu><div class=MEntry><div class=MFile><a href="../files/jquery-ba-hashchange-js.html">jQuery hashchange event</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Index</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MIndex><a href="General.html">Everything</a></div></div><div class=MEntry><div class=MIndex id=MSelected>Events</div></div><div class=MEntry><div class=MIndex><a href="Files.html">Files</a></div></div><div class=MEntry><div class=MIndex><a href="Properties.html">Properties</a></div></div></div></div></div><script type="text/javascript"><!--
24+
<div id=Menu><div class=MEntry><div class=MFile><a href="../files/jquery-ba-hashchange-js.html">jQuery hashchange event</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Index</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MIndex><a href="General.html">Everything</a></div></div><div class=MEntry><div class=MIndex id=MSelected>Events</div></div><div class=MEntry><div class=MIndex><a href="Files.html">Files</a></div></div><div class=MEntry><div class=MIndex><a href="Properties.html">Properties</a></div></div><div class=MEntry><div class=MIndex><a href="Functions.html">Functions</a></div></div></div></div></div><script type="text/javascript"><!--
2525
var searchPanel = new SearchPanel("searchPanel", "HTML", "../search");
26-
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option id=MSearchEverything selected value="General">Everything</option><option value="Events">Events</option><option value="Files">Files</option><option value="Properties">Properties</option></select></div></div><!--Menu-->
26+
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option id=MSearchEverything selected value="General">Everything</option><option value="Events">Events</option><option value="Files">Files</option><option value="Functions">Functions</option><option value="Properties">Properties</option></select></div></div><!--Menu-->
2727

2828

2929
<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>

docs/index/Files.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313

1414
<div id=Index><div class=IPageTitle>File Index</div><div class=INavigationBar>$#! &middot; 0-9 &middot; A &middot; B &middot; C &middot; D &middot; E &middot; F &middot; G &middot; H &middot; I &middot; <a href="#J">J</a> &middot; K &middot; L &middot; M &middot; N &middot; O &middot; P &middot; Q &middot; R &middot; S &middot; T &middot; U &middot; V &middot; W &middot; X &middot; Y &middot; Z</div><table border=0 cellspacing=0 cellpadding=0><tr><td class=IHeading id=IFirstHeading><a name="J"></a>J</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery_hashchange_event" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')" class=ISymbol>jQuery hashchange event</a></td></tr></table>
1515
<!--START_ND_TOOLTIPS-->
16-
<div class=CToolTip id="tt1"><div class=CFile><b>Version: 1.3pre, Last updated: 7/6/2010</b></div></div><!--END_ND_TOOLTIPS-->
16+
<div class=CToolTip id="tt1"><div class=CFile><b>Version: 1.3pre, Last updated: 7/17/2010</b></div></div><!--END_ND_TOOLTIPS-->
1717

1818
</div><!--Index-->
1919

2020

2121
<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
2222

2323

24-
<div id=Menu><div class=MEntry><div class=MFile><a href="../files/jquery-ba-hashchange-js.html">jQuery hashchange event</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Index</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MIndex><a href="General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="Events.html">Events</a></div></div><div class=MEntry><div class=MIndex id=MSelected>Files</div></div><div class=MEntry><div class=MIndex><a href="Properties.html">Properties</a></div></div></div></div></div><script type="text/javascript"><!--
24+
<div id=Menu><div class=MEntry><div class=MFile><a href="../files/jquery-ba-hashchange-js.html">jQuery hashchange event</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Index</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MIndex><a href="General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="Events.html">Events</a></div></div><div class=MEntry><div class=MIndex id=MSelected>Files</div></div><div class=MEntry><div class=MIndex><a href="Properties.html">Properties</a></div></div><div class=MEntry><div class=MIndex><a href="Functions.html">Functions</a></div></div></div></div></div><script type="text/javascript"><!--
2525
var searchPanel = new SearchPanel("searchPanel", "HTML", "../search");
26-
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option id=MSearchEverything selected value="General">Everything</option><option value="Events">Events</option><option value="Files">Files</option><option value="Properties">Properties</option></select></div></div><!--Menu-->
26+
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option id=MSearchEverything selected value="General">Everything</option><option value="Events">Events</option><option value="Files">Files</option><option value="Functions">Functions</option><option value="Properties">Properties</option></select></div></div><!--Menu-->
2727

2828

2929
<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>

docs/index/Functions.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
2+
3+
<html><head><title>Function Index</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="IndexPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
4+
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
5+
6+
<!-- Generated by Natural Docs, version 1.4 -->
7+
<!-- http://www.naturaldocs.org -->
8+
9+
<!-- saved from url=(0026)http://www.naturaldocs.org -->
10+
11+
12+
13+
14+
<div id=Index><div class=IPageTitle>Function Index</div><div class=INavigationBar>$#! &middot; 0-9 &middot; A &middot; B &middot; C &middot; D &middot; E &middot; F &middot; G &middot; <a href="#H">H</a> &middot; I &middot; J &middot; K &middot; L &middot; M &middot; N &middot; O &middot; P &middot; Q &middot; R &middot; S &middot; T &middot; U &middot; V &middot; W &middot; X &middot; Y &middot; Z</div><table border=0 cellspacing=0 cellpadding=0><tr><td class=IHeading id=IFirstHeading><a name="H"></a>H</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/jquery-ba-hashchange-js.html#jQuery.fn.hashchange" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')" class=ISymbol>hashchange</a>, <span class=IParent>jQuery.fn</span></td></tr></table>
15+
<!--START_ND_TOOLTIPS-->
16+
<div class=CToolTip id="tt1"><div class=CFunction>Bind a handler to the window.onhashchange event or trigger all bound window.onhashchange event handlers. </div></div><!--END_ND_TOOLTIPS-->
17+
18+
</div><!--Index-->
19+
20+
21+
<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
22+
23+
24+
<div id=Menu><div class=MEntry><div class=MFile><a href="../files/jquery-ba-hashchange-js.html">jQuery hashchange event</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Index</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MIndex><a href="General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="Events.html">Events</a></div></div><div class=MEntry><div class=MIndex><a href="Files.html">Files</a></div></div><div class=MEntry><div class=MIndex><a href="Properties.html">Properties</a></div></div><div class=MEntry><div class=MIndex id=MSelected>Functions</div></div></div></div></div><script type="text/javascript"><!--
25+
var searchPanel = new SearchPanel("searchPanel", "HTML", "../search");
26+
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option id=MSearchEverything selected value="General">Everything</option><option value="Events">Events</option><option value="Files">Files</option><option value="Functions">Functions</option><option value="Properties">Properties</option></select></div></div><!--Menu-->
27+
28+
29+
<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>
30+
31+
32+
<script language=JavaScript><!--
33+
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>

0 commit comments

Comments
 (0)