Reputation: 1
<select id="myDropDown" onblur='launchSite()'>
<option value="selectone" selected="true">Select One</option>
<option value="http://www.google.com">Google </option>
<option value="http://www.cnn.com">CNN </option>
<option value="http://www.espn.com">ESPN </option>
</select>
<script>
function launchSite() {
var el = document.getElementById("myDropDown");
var url = el.options[el.selectedIndex].value;
window.open(url);
}
</script>
We have a web app that opens a new browser page when a certain values are selected from a dropdown. This worked fine in all previously tested browsers including Safari on ios 5. After the dropdown value is selected in ios 6, we get the Allow/Deny popup which is expected. But then after making a selection on the popup Safari totally freezes. The strange thing is that this freezing does not happen every time. Only occasionally. Is it possible this is a ios 6 bug? I've tried onblur()
like other questions have suggested but I still get ocassional freezing. I am able to see the problem using the code above.
Thanks for any help!
Upvotes: 0
Views: 2360
Reputation: 21
function launchSite(){
window.setTimeout(function(){
var el = document.getElementById("myDropDown");
var url = el.options[el.selectedIndex].value;
window.open(url);
},100); }
Put this in the onchange event handler should solve the freezing problem
Upvotes: 2
Reputation: 2271
We ran into a very similar issue when trying to call:
window.open(url, '_self')
in Chrome and Safari. Instead, define where you want to open the window to:
window.open(url, '_blank')
or
window.open(url, '_new')
However, if you want to open as '_self', or the current window, then just call:
windown.location.href = url;
Upvotes: 0