UI Script for Redirection

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2019 11:16 AM
Hello top experts,
Does anyone know how to use UI Script to redirect the following,
redirecting from /ssp/show_knowledge.do?sysparm_article=KB1234567
to /sp?id=kb_article_view&sysparm_article=KB1234567
for all knowledge article numbers? -- KB1234567 from above is just a sample #.
Thanks in advance!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2019 12:25 PM
I think you would probably write something on your show_knowledge cms page that does the redirect. Basically some JS that runs on the page load, grabs the KB number, then puts it in the window.open() function. You could also rename that cms page and create a new one that does the redirect only. Here some links to get you started:
https://www.w3schools.com/howto/howto_js_redirect_webpage.asp
https://html-online.com/articles/get-url-parameters-javascript/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2021 09:14 PM
window.location.replace('http://w3c.com');
It’s better than using window.location.href = 'http://w3c.com';
Using replace() is better for javascript redirect , 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.