javascript On change event is not firing in Safari

2019-08-30 10:32发布

问题:

I have a dropdown in my page. Whenever a user is selected the option it should open a new window with the selected index url. the below code is working in all browsers except safari.

Any idea to solve this issue..?

<form>
    <select class="searchboxproduct" style="width: 243px;" name="URL"  onchange="window.open(this.form.URL.options[this.form.URL.selectedIndex].value)">
        <option value="">select</option>
        <option value="www.gmail.com/">Gmail</option>
        <option value="www.google.com">google</option>
    </select>
</form>

回答1:

I've tried your code, it didn't open a new tab, either.
But when I set the safari settings to NOT block pop-up windows, it worked !
Therefore I don't think it's your code's problem.

larger size of picture is here