location.href = "/search.php?key=" + encodeURIComponent(key) + "&type=" + type;
Je veux réserver la fenêtre d'origine, comment faire en javascript?Comment faire ceci dans une nouvelle fenêtre?
location.href = "/search.php?key=" + encodeURIComponent(key) + "&type=" + type;
Je veux réserver la fenêtre d'origine, comment faire en javascript?Comment faire ceci dans une nouvelle fenêtre?
window.open("/search.php?key=" + encodeURIComponent(key) + "&type=" + type)
window.open("/search.php?key=" + encodeURIComponent(key) + "&type=" + type);
Vous utilisez la méthode window.open
et spécifiez _blank
comme cible:
var url = '/search.php?key=' + encodeURIComponent(key) + '&type=' + type;
window.open(url, '_blank');