Hi!
In development, the code below works perfectly:
window.history.pushState('', '', `${window.location.href}?scene=${ceneName}`);
But after I generate a build, it doesn’t work.
Any ideas of what is happening?
Hi!
In development, the code below works perfectly:
window.history.pushState('', '', `${window.location.href}?scene=${ceneName}`);
But after I generate a build, it doesn’t work.
Any ideas of what is happening?
Without giving any error messages, it is hard to say. What does console say?
Also, your code snippet has ceneName
, which might be sceneName
instead?
This was a mistake of mine, sorry
But the console shows no error…
Does Playcanvas block this code somehow?
PlayCanvas knows nothing about your JavaScript code. It doesn’t block anything. If the JS code is allowed to run in the target environment, then it is executed by the browser.
The problem was:
console.log(window.location.pathname) //Prints: /index/00daf2c2
For some reason, the script was accessing some other window
.
To solve, I added the /e
on URL to hide the Playcanvas bar.
Thank you for the support.