2012-01-28 12 views
4

問題があります。 history.pushStateによって追加されたURL「コンテンツ」からどのように削除できますか?例えば 私はこのURLを持っている:js history.pushstateを使用した後にデフォルトのURLを設定します。

site.com 

[OK]を、今私はこれに、このURLを更新:

site.com/site/subsite 

私はデフォルトのURL(site.com)を復元するにはどうすればよいです。

私はhistory.pushState("",document.title,document.location.pathname)を試したが、

document.location.pathnameは "site.com/site/subsite"

であると私は開始点に戻り:(

答えて

4
history.pushState("", document.title, "/"); 

それから完全に状態を削除しますドメインのURL。

関連する問題