Answer the question
In order to leave comments, you need to log in
History.API puts / when adding GET variables to the address - how to avoid it?
I use the jquery.history.js plugin
On the page with the address http://larouge/dressing
, when clicking on certain headings, I add a GET variable to the address (for further sharing if the user shares the link).
But instead ?playlist=disco
of adding /?playlist=disco
.
How to avoid adding a slash?
Here is the code:
History.pushState(null, document.title, `?playlist=${scName}`);
Answer the question
In order to leave comments, you need to log in
For the standard browser API without any JQuery there, this way will do
For this plugin, try
History.pushState(null, document.title, `${window.location}?playlist=${scName}`);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question