Hi
This question is for CRM Online version 8.2.
How can I using javascript get a window.location.href parameter? It does not return the same url as I see in the browser.
Thank you.
*This post is locked for comments
USE:
window.location.replace('http://example.com');
It’s better than using window.location.href = ‘http://example.com’;
Using replace() is better because it does not keep the originating page in the session history, meaning the user won’t get stuck in a never-ending back-button fiasco.
You can use assign() and replace methods also to javascript redirect to other pages like the following:
location.assign("">http://example.com");
The difference between replace() method and assign() method(), is that replace() removes the URL of the current document from the document history, means it is not possible to use the “back” button to navigate back to the original document. So Use the assign() method if you want to load a new document, andwant to give the option to navigate back to the original document.
Perfect. Thank you. :-)
Hi ,
Yes it is expected behavior ideally when you are retrieving the url form onload its basically triggering in content page and its depends on where you are triggering javascript method .
You can try to add parent to get the top content URL.
window.parent.location.href
Hope this helps.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Andrés Arias as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Aric Levin - MVP 2 Moderator
MA-04060624-0 1