Reputation: 141120
It opens neither a tab nor a window: the code for a Google Gadget here. If you know 'target="_blank"' from HTML, I am looking for a similar tool for Google Gadgets. More precisely, I cannot understand why the JavaScript piece does not work:
window.open("http://www.google.com/");
Upvotes: 0
Views: 1825
Reputation: 32233
Well, if you want to open the new window, do it explicitly.
var query = "bijection";
var searchUrl = "http://www.google.com/search?q=";
if (query != "" && searchUrl != "") {
searchUrl += escape(query);
window.open(searchUrl); //You can pass additional parameters, look for window.open examples on the Internet.
return false;
}
The target attribute is for link element () which instructs browser to open the URL in new window if user clicks on it.
Upvotes: 3
Reputation: 1067
Like this?
searchUrl += escape(query);
thenewwindow=window.open(searchUrl,'Google','height=600,width=450');
return false;
Upvotes: 0
Reputation: 655219
Open a new window with that target instead of replacing the current’s window URL:
var query = "bijection";
var searchUrl = "http://www.google.com/search?q=";
if (query != "" && searchUrl != "") {
searchUrl += escape(query);
var newWindow = window.open(searchUrl, '_blank');
return false;
}
Upvotes: 2