I have an issue with my development setup.
I want to echo an url in a data-attribute. I then use this url to update the displayed url in the browser :
History.replaceState(null, document.title, url);
It works fine in a prod server and even a regular localhost, I get urls like http://localhost/the-path
.
But I’m using browsersync which runs on a :3000
port, and from there I don’t get this “absolutely absolute” url but :
//localhost:3000/the-path
Which messes things up when used as is to modify the browser history. Of course it isn’t that painful to rewrite it afterwards with the correct protocol, but I still wonder if there’s a way to echo it with the protocol in the first place ?