Permalink
Browse files

I've added a method that checks if HTML5History is supported(for URLs…

… without Hashtags, for example Google+)
  • Loading branch information...
1 parent 3d453b2 commit b647718e822e00ba51a87d8329a05ad558cb5c2d @theunreplicated theunreplicated committed with Apr 1, 2012
Showing with 13 additions and 2 deletions.
  1. +13 −2 router.js
View
@@ -15,13 +15,24 @@ goog.require('goog.History');
* @constructor
*/
mvc.Router = function() {
- this.history_ = new goog.History();
+ this.checkhistorysupport();
goog.events.listen(this.history_, goog.history.EventType.NAVIGATE,
this.onChange_, false, this);
this.history_.setEnabled(true);
this.routes_ = [];
};
-
+/**
+*checks if HTML5History is supported
+*/
+mvc.prototype.checkhistorysupport=function (){
+ if(goog.history.Html5History.isSupported()){
+ this.history_= new goog.history.Html5History();this.history_.setUseFragment(false);
+}
+else
+{
+ this.history_=new goog.History();
+}
+};
/**
* pass through the fragment for the URL
*

0 comments on commit b647718

Please sign in to comment.