Results 1 to 5 of 5

Thread: Specify target window size without Javascript?

  1. #1
    Join Date
    Jul 2007
    Location
    New Zealand
    Posts
    81
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Specify target window size without Javascript?

    I'm want to have a link on my page, that when clicked on, opens up a new window, but I want to specify the size of that window - is there a way to do that without javascript?

    Traditionally, target="blank" or target="new" etc will open up another window but can you specify the size of that window?

  2. #2
    Join Date
    Feb 2007
    Posts
    293
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Javascript will open up the window in a specific height and width, plus with or without scrollbars, etc. You can combine the javascript call with a noscript tag that calls for the window to just open with a target. That way, if someone has javascript turned off, they can still access the content.

    <a href="#" onClick="window.open('yourpage.htm','pagename','resizable,height=260,width=370'); return false;">New Page</a><noscript>You need Javascript to use the previous link or use <a href="yourpage.htm" target="_blank">New Page</a></noscript>

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    To answer your question, no, there isn't. Support for the target attribute has also been dropped in modern standards; you're advised to avoid popups at all. If it's more convenient to open a certain link in a new window or tab, it's up to the user to open it as the user prefers and resize it to dimensions that make sense on his/her system, taking into account things like font size, visual acuity, and screen resolution.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Jul 2007
    Location
    California
    Posts
    177
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I know this is silly, and I don't think it is javascript, but is this line of code javascript?: <p><a href="/dispute_print.html" onclick="NewWindow(this.href,'name','600','800','yes');return false">Click here for a printable dispute form for mailing.</a><br><br>

    The reason I ask is because that code gives me a pop up window sized how I want in IE7, Opera, Safari, and FF

  5. #5
    Join Date
    Jul 2007
    Location
    New Zealand
    Posts
    81
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default

    Thanks guys for all your replies.

    To answer your question, no, there isn't. Support for the target attribute has also been dropped in modern standards; you're advised to avoid popups at all. If it's more convenient to open a certain link in a new window or tab, it's up to the user to open it as the user prefers and resize it to dimensions that make sense on his/her system, taking into account things like font size, visual acuity, and screen resolution.
    Thanks. It wouldn't have been a forced pop-up, but rather an option if someone required it because they can't run script.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •