Permalink
Browse files

$.pjax() calls redirect to the passed URL when pjax isn't supported.

  • Loading branch information...
1 parent a4db9d0 commit 7011b9e1bd36bf1d2dc99143a19db212aa95f4fe @spantaleev spantaleev committed with defunkt Jun 5, 2011
Showing with 7 additions and 3 deletions.
  1. +3 −0 README
  2. +4 −3 jquery.pjax.js
View
3 README
@@ -172,6 +172,9 @@ For a table of supported browsers see: http://caniuse.com/#search=pushstate
To check if pjax is supported, use the `$.support.pjax` boolean.
+When pjax is not supported, $('a').pjax() calls will do nothing (aka links
+work normally) and $.pjax({url:url}) calls will redirect to the given URL.
+
## install it
View
@@ -216,10 +216,11 @@ $.support.pjax = window.history && window.history.pushState
// Fall back to normalcy for older browsers.
-if ( !window.history || !window.history.pushState ) {
- $.pjax = $.noop
+if ( $.support.pjax ) {
+ $.pjax = function( options ) {
+ window.location = $.isFunction(options.url) ? options.url() : options.url
+ }
$.fn.pjax = function() { return this }
}
-
})(jQuery);

0 comments on commit 7011b9e

Please sign in to comment.