Open ionitron-bot[bot] opened 5 years ago
所以问题还没有得到有效果的解决方法对吗?
所以问题还没有得到有效果的解决方法对吗?
Seems that the answer is a No......
is anybody still following up this issue, this is such an essential matter, I have to handle a redirect from 3rd party api where I got no control over the url, so I have to handle query param, upgrade to 4 is not an option for now. any quick solutions?
I faced this problem, then I managed on my way.
Ionic redirects the first arriving URL to proper URL. You can't retrieve the first arriving URL even if you write in app.components.ts
.
That's why you need to write your code in index.html
.
Write the below code in your index.html file directly.
This keeps the first arriving URL to window.firstURL
.
<script type='text/javascript'>
Object.defineProperty(window, "firstURL", {
enumerable: false,
value: location.href,
writable: false
});
</script>
Then you can retrieve it anywhere in your code like this.
const firstURL = (window as any).firstURL;
console.log(firstURL);
Ionic version: [ ] 1.x [ ] 2.x [x] 3.x
I'm submitting a ... [ ] bug report [x] feature request [ ] support request
Current behavior: Currently when I have a URL with parameters (e.g.
..?a=hello&b=world
) they get cut off by Ionic routing.http://localhost:8100/#/nav/n4/intro?a=hello&b=world
gets changed tohttp://localhost:8100/#/nav/n4/intro
.These parameters are for FB tracking and such and are necessary on all pages.
Expected behavior:
http://localhost:8100/#/nav/n4/intro?a=hello&b=world
should stay like that.I would like to keep these parameters. Ideally it would be a settings parameter.
Steps to reproduce: Add
?a=hello&b=world
at the end of your URL and do a refresh. The added parameters will be removed.Related code:
Other information:
Ionic info: