What's the best way to open new browser window?

前端 未结 10 1545
一生所求
一生所求 2021-01-30 03:06

I know that most links should be left up to the end-user to decide how to open, but we can\'t deny that there are times you almost \'have to\' force into a new window (for examp

10条回答
  •  抹茶落季
    2021-01-30 03:41

    If you use any flavor of strict doctype or the coming real xhtml-flavors, target isn't allowed ...

    Using transitional, whatever being HTML4.01 or XHTML1, you can use Damirs solution, though it fails to implement the windowName-property which is necessary in window.open():

    In plain html:

    link
    

    If however you use one of the strict doctypes your only way of opening links would be to use this solution without the target-attribute ...

    -- by the way, the number of non-js-browsers is often miscalculated, looking up the counters numbers refer very different numbers, and I'm wondering how many of those non-js-browsers is crawlers and the like !-)

提交回复
热议问题