I have a page with an url that looks like so:
some.unit.gov/app/source/index.jsp#someActivityPage?10/NEW/20?true
window.location.host //returns : 'some.unit.gov'
window.location.pathname // returns : '/app/source/index.jsp
window.location.search // always return ' '
The host application consists other embedded links , which when clicked redirects the page
(which is the part after ‘#’).
Please note:
values ‘someActivityPage’, ‘NEW’, ‘true’ – are all dynamic values
Both numbers (10, 20) – are dynamic as well
How can I extract the ‘true’ value of the url in a render() method of BackboneJS.
The issue is :
In chrome dev tools
window.location.href.substr(window.location.href.lastIndexOf('?') + 1); //returns 'true' exactly what I need
But inside the application, I suspect since javascript loads all the views on initial application load, always returns some.unit.gov/app/source/index.jsp because the view has already been initialized.
I also tried :
var searchParams = new URLSearchParams(window.location.search);
searchParams.has('false');
This always returns false regardless of what argument I provide.