Opening new window in HTML for target=“_blank”

前端 未结 3 541
遥遥无期
遥遥无期 2020-11-29 01:44
Share this

How do I make this a certain width and height, in a new window, when

相关标签:
3条回答
  • 2020-11-29 02:01

    To open in a new windows with dimensions and everything, you will need to call a JavaScript function, as target="_blank" won't let you adjust sizes. An example would be:

    <a href="http://www.facebook.com/sharer" onclick="window.open(this.href, 'mywin',
    'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" >Share this</a>
    

    Hope this helps you.

    0 讨论(0)
  • 2020-11-29 02:06

    You don't have that kind of control with a bare a tag. But you can hook up the tag's onclick handler to call window.open(...) with the right parameters. See here for examples: https://developer.mozilla.org/En/DOM/Window.open

    I still don't think you can force window over tab directly though-- that depends on the browser and the user's settings.

    0 讨论(0)
  • 2020-11-29 02:12

    You can't influence neither type (tab/window) nor dimensions that way. You'll have to use JavaScript's window.open() for that.

    0 讨论(0)
提交回复
热议问题