How to use FlowRouter to parse any given url?

149 Views Asked by At

I want to parse an iframe URL using FlowRouter.getQueryparams() instead of using window.location.href.split(). I have tried looking into documents, but all it talks about is passing parameters and in-app routing. Is there a way to pass URL like : http://localhost:3000/?id="Awx34R56YUND"&userId="QP90pr5f" to Flowrouter and get the parameters like FlowRouter.getQueryparams('id') and FlowRouter.getQueryparams('userId')?

1

There are 1 best solutions below

2
electrode On

Yes you can get query parameters in a URL, see this example below

// route def: /apps/:appId
// url: /apps/this-is-my-app?show=yes&color=red

var color = FlowRouter.getQueryParam("color");
console.log(color); // prints "red"

source: Documentation