Redirection from service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 10:51 AM
We are facing issue, with service portal redirection.
The service portal is: https://support-dev.xy.com/csm
When customer tries to open this portal, they should be redirected to another page " https://www.ab.com/info/cust-supp.html ".
We have configured the ui script of the portal, as follows:
csm portal page:
path to ui script:
service portal> theme>js include>ui script
This redirects to the new page properly but in the new page contains a link which again redirects to the URL "https://support.xy.com/csm?id=xxxxxxxxxxxxxxxxxxxx&sys_id=yyyyyyyyyyyyyyyyyyyyyyy".
The problem is when customer clicks on the link in the new page, the link does not open, rather it redirect backs to "https://www.ab.com/info/cust-supp.html ". because the redirection logic finds the CSM keyword and the redirection loop goes on.
Is there any way, we can break this redirection loop?
When the customer clicks on the link on the page " https://www.ab.com/info/cust-supp.html ", it should redirect to "https://support.xy.com/csm?id=xxxxxxxxxxxxxxxxxxxx&sys_id=yyyyyyyyyyyyyyyyyyyyyyyy" instead of redirecting back to https://www.ab.com/info/cust-supp.html ".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 11:09 AM
Hi @Rudranarayan P2 ,
This is like a loop of redirection, you can try to add a query parameter in the URL on the redirection for the first time, and add a check condition to check if the query parameter is already present in the URL.
I have provided the code below.
(function() {
// Check if the URL already contains myparam=true
if (window.location.href.indexOf('myparam=true') == -1) {
// Redirect to the new page and add the the query parameter in the url
window.location.href = 'https://www.ab.com/info/cust-supp.html?myparam=true';
}
})();
Thanks,
Hope this solution works for you, let me know if it worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2024 03:55 AM
Hi @HrishabhKumar ,
Thanks for your quick reply.
But i have few doubts.
1. I am using window.location.replace() method, to redirect to new site. but you have mentioned "window.location.href". should i use "window.location.href" instead of "window.location.replace"?
2. Is it ok, to add the query parameter at the end of the URL? Will it open the site? how does query parameter work?
If you can answer my queries, that will be really helpful.
Thanks
Rudra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2024 04:35 AM
Hi @Rudranarayan P2 ,
Answering to your doubts below:
1) You can use any of the method, both works fine.
2) There will be no problems or performance issue, if we add query parameters in the URL. Query parameters provide additional information to a web server when making requests. you can learn more about them here : https://www.branch.io/glossary/query-parameters/#:~:text=Query%20parameters%20are%20a%20defined,on%2....
Thanks,
If my response helped please mark this solution as helpful and accept it as solution to close this thread and for reference of others.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 03:07 AM