You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+30-4
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
-
## pushState + ajax / hash navigation + ajax / hash navigation + ajax + form ajax + get forms parameters in address = pjax with normal fallback!
1
+
# pjax with normal fallback!
2
+
## pushState, hash-navigation, ajax forms, interchangeable url formats and other remarkable features
2
3
3
4
.--.
4
5
/ \
@@ -27,7 +28,7 @@ I hope, you'll enjoy mix of pushState and regular #!/hash navigation.
27
28
28
29
Some features and changes:
29
30
30
-
*IE 7,8 support (maybe some others)
31
+
*IE7+, FF4+ and all modern browsers (if it works on some not mentioned ancient browser – please let me know `[email protected]`)
31
32
* mix of html5-like navigation and old-school #!/hashes
32
33
* i added most of ';' in lines of code for you :]. for some reason, defunkt didn't use them, but it was strange for me
33
34
* links from both kinds of browsers are interchangable
@@ -37,10 +38,27 @@ Some bad news:
37
38
* you HAVE to put some settings before using:
38
39
39
40
```js
40
-
$.siteurl='http://yousite.com';
41
+
$.hash='#!/';
42
+
$.siteurl='http://yoursite.com';
41
43
$.container='#pjaxcontainer';
42
44
```
43
45
46
+
`$.hash` is a string, which appeares is url, when browser doesn't support pushState. So, by default, url of page changes from http://yoursite.com/this/is/awesome/article to http://yoursite.com/#!/this/is/awesome/article and pjax sends request to server with first url.
47
+
48
+
Links are interchangable – so if someone with modern browser gets old-style link http://yoursite.com/#!/page – he would be redirected to http://yoursite.com/page and vice versa.
49
+
50
+
## And what about SEO?
51
+
52
+
All we know, most part of AJAX-enabled sites have issues with search engine crawlers – their links are basically not parsable because of `#`. But we can handle it at least with Google!
53
+
54
+
Default `$.hash` value is meaningful and hopely would be parsed in future by all major search engine crawlers. All you need – set up some custom routing on your server: if crawler meets link like http://yoursite.com/#!/some/path/on/site, he sends request to http://yoursite.com/?_escaped_fragment_=/some/path/on/site and parses it.
0 commit comments