javascript - history.pushState how can I get rid of get parameters? -


i using

  history.pushstate('id','mytitle','myurl'); 

to manipulate displayed url , history stack. @ point pushing parameters so:

history.pushstate('id','mytitle','?mysublinkedstuff=hotsublinkedstuff'); 

now when do

history.pushstate('id','mytitle','#justsomehashtag'); 

it produces http://example.com?mysublinkedstuff=hotsublinkedstuff#justsomehashtag can overwrite value of mysublinkedstuff not seem able rif of alltogether.

desired result:

http://example.com#justsomehashtag or http://example.com/#justsomehashtag

and don't want make whole roundtrip on server , want avoid using absolute path or url keep project portable.

as nimrodargov rightly remarked: overwriting existing get-parameter strings works if push full url. ensuring portability of app (keep usable on various domains) did this:

history.statepush(document.location.origin + window.location.pathname + '#myhashvalue'); 

works , fast.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -