I am trying to get the url query string parameters from current page and I have the following code:
doInit: function (component, event, helper) {
var urlParams = new URLSearchParams(window.location.search);
console.log("params::: ", urlParams);
if (urlParams.has("openSidebar") && urlParams.get("openSidebar") == true) {
console.log("redirection happening....");
component.set("v.showFeed", true);
component.set("v.isSidebarOpen", true);
}
},
for some reason seems that I cannot use this line var urlParams = new URLSearchParams(window.location.search); and I dont know why.
Are there any alternative or salesforce way hwo to get the query string parameters from url?
I am basically getting nothing, the execution seems to stop at the line where I am using URLSearchParams!
Also curious to know why does lightning does not let plain javascript to execute in this case?