Window.location.pathname not correct on playcanvas hosted builds


I’m using window.location.pathname to add query strings in runtime and manipulating the window.history to update the url.

in launch mode this works fine, however, if I build and host this app at, I get a mismatch between the location pathname reported in my code and the one I see if I run the command in the browser console.

  1. Code reports window.location.pathname="/index/prm1w5fO/"
  2. Browser console reports window.location.pathname="/b/prm1w5fO/"

This messes up my url, and query string is never updated. What’s going on here?

The published build is iframed.

You can try making it non framed by adding an /e before the /b in the URL.


1 Like

ah that’s why. I also tried exchanging /b/ for /index/ which worked.

1 Like