2016-07-07 7 views
0

So habe ich die folgende URL:window.history.pushState Änderung url ohne letzte Teil entfernen

https://example.com/page/foo 

Und ich bin mit pushstate wie folgt aus:

window.history.pushState(window.location.href, null, 'product/'+data.name+'/'+data.item); 

Nun, das Problem ist, dass wenn es die uRL ändert, entfernt es „foo“, so dass die neue uRL

https://example.com/page/product/product-name/123 

sein wird, und ich will das nicht, ich will halten die ursprüngliche URL ... und die neuen Sachen dieser Stelle

Antwort

1

Verwenden

window.history.pushState (null, null, window.location.href + 'Produkt /' + data.name + '/' anhängen + data.item);