- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2020 02:43 AM
How to redirect to a particular URL after click ok in alert message?
Please help in this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2020 02:51 AM
Hi Vishal,
you should use confirm box for this.
An alert does not return a value, in fact returns undefined so the easiest way is conditioning the alert like this
if(!alert("Your text here"){
var url = 'URL Here'; // pass your url here
g_navigation.open(url, '_blank');
}
Or another better way is using confirm() javascript function like this
if(confirm("your text here")){
var url = 'URL Here'; // pass your url here
g_navigation.open(url, '_blank');
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2020 02:51 AM
Hi Vishal,
you should use confirm box for this.
An alert does not return a value, in fact returns undefined so the easiest way is conditioning the alert like this
if(!alert("Your text here"){
var url = 'URL Here'; // pass your url here
g_navigation.open(url, '_blank');
}
Or another better way is using confirm() javascript function like this
if(confirm("your text here")){
var url = 'URL Here'; // pass your url here
g_navigation.open(url, '_blank');
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2020 03:40 AM
Hi Ankur
thanks a ton!
it works 🙂