I have the following JavaScript code:
dropdown.onchange = function(e){
e.preventDefault();
var id = this.value;
var w = window.open('', '_blank');
$.ajax({
url: '../../getSearchSonBySearchId.php',
type: 'POST',
async: false,
dataType: 'Text',
data: {'search_id': id},
error: function(a, b, c) { alert(a+b+c); }
}).done(function(data) {
var search_criteria = data;
var cx = '*******';
var api_key = '******';
w.location = "http://www.calimedia.net/search.html?q=" + search_criteria;
});
};
In the code above, imagine dropdown is a variable referring to an HTML drop down list. I am trying to avoid browser popup blockers when I select an option from my drop down list.
I have checked the following questions in SO and a few others:
It looks like the only way of preventing a popup is if the event of opening a new page comes from a trusted event or from a user (person). Is there any way I can make the browser think my onchange event is a trusted event?