How to redirect user using location.search inside widget's client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2023 03:18 AM
How can I redirect the user to specific url that I want using location.search?
for example if the condition is met and I want to redirect the user to www.google.com or to a different url, how can I do that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2023 04:08 AM
Hi @Alon Grod
If you want to simulate someone clicking on a link, use location.href
top.location.search = "http://www.google.com";
If you want to simulate an HTTP redirect, use
top. location.replace = "http://www.google.com";
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2023 05:15 AM
@Maik Skoddow hi Maik, I just want to redirect the user straight to a desired page. I tried to use:
location.url(link);
The user is being redirect to the desired page but the problem is I can see two pages in one page (SOW inside SOW), but i think its because Im using location.url instead of location.search:
This is the full script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2023 05:29 AM
Hi @Alon Grod
did you read my answer carefully?
I wrote
top.location.search
There is a reason for the leading "top." !!!
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2023 08:26 AM
@Maik Skoddow but why did u use '=' instead of ()