Skip to content
Permalink
Browse files

fix(router): Added pushState fallback for IE 9 browser.

Closes #6506

Closes #7929
  • Loading branch information...
sasidhar authored and mhevery committed Apr 6, 2016
1 parent 5e12a95 commit bab6023eee1d34a8b27c28cd44af3c9096b167cd
@@ -2,7 +2,7 @@ import {Injectable} from '@angular/core';
import {History, Location} from '../../../src/facade/browser';
import {UrlChangeListener, PlatformLocation} from '@angular/common';
import {getDOM} from '../../dom/dom_adapter';

import {supportsState} from './history';


/**
@@ -46,11 +46,19 @@ export class BrowserPlatformLocation extends PlatformLocation {
set pathname(newPath: string) { this._location.pathname = newPath; }

pushState(state: any, title: string, url: string): void {
this._history.pushState(state, title, url);
if(supportsState()) {
this._history.pushState(state, title, url);
} else {
this._location.hash = url;
}
}

replaceState(state: any, title: string, url: string): void {
this._history.replaceState(state, title, url);
if(supportsState()) {
this._history.replaceState(state, title, url);
} else {
this._location.hash = url;
}
}

forward(): void { this._history.forward(); }
@@ -0,0 +1,3 @@
import 'dart:html' show History;

bool supportsState() => History.supportsState;
@@ -0,0 +1,3 @@
export function supportsState(): boolean {
return !!window.history.pushState;

This comment has been minimized.

Copy link
@valorkin

valorkin May 27, 2016

Contributor

Can usage of window here, block universal server rendering?

}

0 comments on commit bab6023

Please sign in to comment.
You can’t perform that action at this time.