Append Unique ID to URL on Page Load


#1

I have a very simple, single page application. Using a router I can very easily pull a URL parameter out and use that as an ID, but I can’t figure out how to automatically append a unique ID to the URL on page load.

When a user navigates to the home of my application without any parameters, I want to automatically append that URL with a random unique ID, e.g. myapp.com/zAtcOd08nL1oLc

So that I can then use that unique parameter to create a new collection for that user.

Any advice would be greatly appreciated.


#2

If you use FlowRouter for example, check the route /. As action create a unique id e.g. Random.id() and do a url forward by calling FlowRouter.go(’/’ + Randmom.id())