2

shinyMobile's inst/framework7-5.7.8/my-app.js file has the following code chunk at the top:

if (typeof workerId != "undefined") {
  var hash = window.location.hash;
  var search = window.location.search;
  var pathname = window.location.pathname;
  var newpath = pathname + workerId + search + hash;
  window.history.replaceState( {} , 'newpath', newpath);
}

It appends a random string (the worker ID) to the URL of the app whenever it is not run locally. E.g., https://my_domain/my_app/ becomes https://my_domain/my_app/_w_123456/.

This is super annoying, as it prevents search parameters (e.g., ?param=test) from being consistently captured (screencast video).

So, I followed the solution found in this post and commented out the line window.history.replaceState( {} , 'newpath', newpath); above.

Now, worker IDs do not appear in the URL anymore. But the links of the app's tabs are still somehow initialized with the worker IDs! E.g., https://my_domain/my_app/_w_123456/#tabset-tab1. And, upon first click, because of my change above, they get updated to not containing the worker IDs (https://my_domain/my_app/#tabset-tab1), causing them to become broken! Please see this new screencast.

I tried to locate the script where the tab links are initialized in shinyMobile, but I could not find it. Maybe it is a framework7 feature?

Any tip would be greatly appreciated, as I have absolutely no clue how to solve this.

PS: I did post to shinyMobile's GitHub, but looking at the other recent issues, it seems it is unlikely I will get an answer any time soon.

2
  • Wouldn't it be better to change the previous line var workerId = $('base').attr('href'); to var workerId = undefined;?
    – vqf
    Dec 30, 2020 at 14:39
  • I just tried, unfortunately it does not change anything :(
    – Antoine
    Dec 30, 2020 at 19:07

1 Answer 1

0

The author of the package implemented a fix: https://github.com/RinteRface/shinyMobile/issues/140#issuecomment-754765964 Many thanks to him!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.