how to open href link in same window

Deepthi25
Giga Expert

Hi , Below code i am using to display that href link (catalog item) in new tab. but it is redirecting in same page to that catlog item ut i want to open that in below to the same page.

<select name="select-website"onchange="window.open(this.options[this.selectedIndex].value, '_self');">

<option value="https://www.google.com/" target="_blank">SketchUp Pro</option>
<option value="https://dev68174.service-now.com/sp?id=sc_cat_item&sys_id=4a17d6a3ff133100ba13ffffffffffe7">Dell E7490 (Standard Large Laptop)</option>
<option value="https://www.flipkart.com/"target="_blank">External Monitor</option>
</select>

7 REPLIES 7

hi Sunil, your under standing is right!  Thanks for your input.

I just want to elaborate my scenario.  

1. I have cloned sc order guide widget and edit the widget for my requirement

2. My requirement is when i click the drop down below as shown in figure, that catalog item needs to open down only. But not in new tab or redirecting that page.

for that i am using code in HTMl as below,

<select name="select-website"onchange="window.open(this.options[this.selectedIndex].value, '_self');">
<option value="https://www.google.com/" target="_blank">SketchUp Pro</option>
<option value="https://dev68174.service-now.com/sp?id=sc_cat_item&sys_id=4a17d6a3ff133100ba13ffffffffffe7" onclick="https://dev68174.service-now.com/sp?id=sc_cat_item&sys_id=4a17d6a3ff133100ba13ffffffffffe7" >Dell E7490 (Standard Large Laptop)</option>
<option value="https://www.google.com/" target="_blank">SketchUp Pro</option>
<option value="https://www.flipkart.com/"target="_blank">External Monitor</option>
</select>

 

current behavior: it is redirecting to the catalog item in the same page. please suggest  

find_real_file.png

Sunil B N
ServiceNow Employee
ServiceNow Employee
<script>
var navigateToURL = function(url){
   var win =  window.parent? window.parent : window;
   win.open(url, '_self');
};
</script>

<select name="select-website"onchange="navigateToURL(this.options[this.selectedIndex].value);">

Could you please see below, and rectify me if some thing is missed below,

 

var navigateToURL = function(url){
var win = window.parent? window.parent : window;
win.open(https://dev68174.service-now.com/sp?id=sc_cat_item&sys_id=4a17d6a3ff133100ba13ffffffffffe7, '_self');
};
</script>
<select name="select-website"onchange="navigateToURL(this.options[this.selectedIndex].value);">
<option href= "https://dev68174.service-now.com/sp?id=sc_cat_item&sys_id=4a17d6a3ff133100ba13ffffffffffe7";
value="https://dev68174.service-now.com/sp?id=sc_cat_item&sys_id=4a17d6a3ff133100ba13ffffffffffe7"
onclick="navigateToURL" >Dell E7490 (Standard Large Laptop)</option>
</select>