return FALSE; $r = well_tag_thread__update(array('id' => $id), $update); return $r; } function well_tag_thread_find($tagid, $page, $pagesize) { $arr = well_tag_thread__find(array('tagid' => $tagid), array('id' => -1), $page, $pagesize); return $arr; } function well_tag_thread_find_by_tid($tid, $page, $pagesize) { $arr = well_tag_thread__find(array('tid' => $tid), array(), $page, $pagesize); return $arr; } ?>javascript - JSP window.open() function - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - JSP window.open() function - Stack Overflow

programmeradmin2浏览0评论

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
Add a ment  | 

3 Answers 3

Reset to default 2

Please 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

发布评论

评论列表(0)

  1. 暂无评论