on lightning community using napili template when you are on a page with url and query parameters e.g. https://host/path1?name=value
then one of the lightning component fires e.force:navigateToURL for a relative url the query parameters from previous URL are still there, e.g. you ask to go to /path2 then the URL becomes https://host/path2?name=value
is there a way to get rid of those query parameters? I tried to strip it from window.location.href (but without reloading the page) but after the event is fired the query parameter is back.
Best Answer
You should be able to build an absolute URL which will remove the qs params like so:
Yes it would be nice to have an attribute on the event which would not preserve qs params.