I am creating a JSP page in which a new window must be opened with some content. Example:
window.open("www.stackoverflow");
The program opens a "new window" when we use Internet Explorer browser. The same program opens a "new tab" not "new window" when we use Google Chrome browser. What is the problem behind this? Also let me know the solution?
I am creating a JSP page in which a new window must be opened with some content. Example:
window.open("www.stackoverflow.");
The program opens a "new window" when we use Internet Explorer browser. The same program opens a "new tab" not "new window" when we use Google Chrome browser. What is the problem behind this? Also let me know the solution?
Share Improve this question edited Feb 24, 2013 at 15:38 ajp15243 7,9601 gold badge35 silver badges38 bronze badges asked Feb 24, 2013 at 15:34 user1791618user1791618 1731 gold badge4 silver badges12 bronze badges 1- Possible duplicate: stackoverflow./questions/726761/… – ajp15243 Commented Feb 24, 2013 at 15:36
3 Answers
Reset to default 2Please note that window.open is JavaScript function but not JSP, JSP is for server side and JavaScript is for client side.
For popping up a new window in chrome, you have to specify the "specs" of the new window. Here is an example.
window.open("www.stackoverflow.", "", "toolbar=yes,menubar=no,resizable=yes,scrollbars=yes,width=1024");
For more details of the "specs", please refers to w3school http://www.w3schools./jsref/met_win_open.asp
Hope this can help you.
Remember, first, that JSPs are evaluated server-side and spit out markup that is sent to the browser, where something like window.open()
(which is JavaScript) is then executed client-side.
Second, whether it opens a new tab or a new window is (as my ment's link indicates) dependent upon the user's preferences in their browser, and as such is not anything you can control. You should be able to change your own browser settings in IE and Chrome to test this.
As all said It's an javascript
fucnction. Not jsp's.
If you did'nt set any ant target it depends on the browser specification
.
So ,it always better to mention the target attribute
to get rid off browser dependency .
Here is the target list defined by W3C.
http://www.w3schools./tags/att_a_target.asp
Ex:window.open("www.stackoverflow.","_self");//Always opens in same tab