javascript – How to do this in a new window? – Education Career Blog

location.href = "/search.php?key=" + encodeURIComponent(key) + "&type=" + type;

I want to reserve the original window ,how to do it in javascript?

,

window.open("/search.php?key=" + encodeURIComponent(key) + "&type=" + type)

,

window.open("/search.php?key=" + encodeURIComponent(key) + "&type=" + type);

,

You use the window.open method, and specify _blank as target:

var url = '/search.php?key=' + encodeURIComponent(key) + '&type=' + type;
window.open(url, '_blank');

Leave a Comment