Simple HTML command.. _blank window size?-VBForums
Results 1 to 15 of 15

Thread: Simple HTML command.. _blank window size?

  1. #1

    Thread Starter
    Frenzied Member some1uk03's Avatar
    Join Date
    Jun 2006
    Location
    London, UK
    Posts
    1,269

    Simple HTML command.. _blank window size?

    Hello

    Since im a noob at html could anyone tell me how to specify the size of a window once i add a link to an image and target fram being _blank ?

    Im using MS FrontPage. The link and stuff is working, but i just cant get the new window to be the size i want it to be...

    What shall i do..?

    javascript ?? or is it possible with html?
    _____________________________________________________________________

    ----If this post has helped you. Please take time to Rate it.
    ----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.



  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Simple HTML command.. _blank window size?

    It's not possible using _blank, and that technique is an abomination anyway.

    You can use JavaScript, but only if you have a legitimate reason to open a popup. Look for window.open().
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3
    Moderator
    Join Date
    Jan 2005
    Location
    Sydney
    Posts
    13,621

    Re: Simple HTML command.. _blank window size?

    You shouldn't open a new window, I am pushed to think of a valid reason to do so. If you absolutely must have a popup effect use Javascript DOM functions to create a floating div element. New windows break the browsing models that are not window-centric (such as tabbed browsing).

  4. #4

    Thread Starter
    Frenzied Member some1uk03's Avatar
    Join Date
    Jun 2006
    Location
    London, UK
    Posts
    1,269

    Re: Simple HTML command.. _blank window size?

    well all i want to be able to do is basically i have a small image on the page, and when it is clicked, the larger (original sized) version appears in a new window, with its actual dimension and not a 300x300 pic and window opened at say 1024x768 screen resolution..!!
    _____________________________________________________________________

    ----If this post has helped you. Please take time to Rate it.
    ----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.



  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Simple HTML command.. _blank window size?

    Why not just link to the picture? The user can use something as simple as the back button to get back to your page.

    Especially Opera users, who are probably used to the quick Back mouse gesture but less to the Close Window mouse gesture (which is probably more complicated, if it even exists), will thank you.

    What happens if you open a window at 1024x786, but the user has only a 800x600 screen? What about if he has a 1600x1200 screen? In either case, the existing browser window will most likely be the size he wants it. Can you guarantee the same thing for a popup, where you control the size instead of the user?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6

    Thread Starter
    Frenzied Member some1uk03's Avatar
    Join Date
    Jun 2006
    Location
    London, UK
    Posts
    1,269

    Re: Simple HTML command.. _blank window size?

    I dont actually want a direct link, because you gotta press the BACK button and RE-Load the page..>!! just time waste..

    However, i have given a try on this code which i found on the net..
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    <!-- In the head section of the page -->
    <script>
    <!--
    function wopen(url, name, w, h)
    {
    // Fudge factors for window decoration space.
    // In my tests these work well on all platforms & browsers.
    var win = window.open(url,
    name,
    'width=' + w + ', height=' + h + ', ' +
    'location=no, menubar=no, ' +
    'status=no, toolbar=no, scrollbars=no, resizable=no');
    win.resizeTo(w, h);
    win.focus();
    }
    // -->
    </script>

    When it comes time to actually open such a window, just write a link like the following:

    <a href="page.html" target="popup"
    onClick="wopen('page.html', 'popup', 640, 480); return false;"> Click here to open the page in a new window. </a>
    '''''''''''''''''''''''''''''''''''''''''''

    Now i got this working BUT it only works properly with Internet Explorer and not FireFox..!?! I dont know why..!
    _____________________________________________________________________

    ----If this post has helped you. Please take time to Rate it.
    ----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.



  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Simple HTML command.. _blank window size?

    Quote Originally Posted by some1uk03
    I dont actually want a direct link, because you gotta press the BACK button and RE-Load the page..>!! just time waste..
    No, you don't. All modern, proper browsers (i.e. Firefox and Opera) cache the internal data structures of the last few pages visited -> no reload at all, not even a reparse.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  8. #8
    Moderator
    Join Date
    Jan 2005
    Location
    Sydney
    Posts
    13,621

    Re: Simple HTML command.. _blank window size?

    Quote Originally Posted by some1uk03
    However, i have given a try on this code which i found on the net..
    [snip]
    Now i got this working BUT it only works properly with Internet Explorer and not FireFox..!?! I dont know why..!
    Because you blindly copied and pasted crap code without understanding how it works and why it's crap. This is why I loathe Javascript websites.

    If you want to use Javascript, learn it yourself.
    Otherwise, take CornedBee's advice.

  9. #9
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Simple HTML command.. _blank window size?

    Not very friendly today, are we?


    Users of browsers that support tabbed pages, which includes the upcoming IE7, often quickly learn to open all picturelinks at once by middle clicking on the links, opening the pictures into tabs. Once my sister learned this, she had no reason to use IE6 anymore. Atm she is an Opera user, because she've had some disappear crash issues with Firefox on her machine.

    Opera also appears to have some kind of feature that is able to browse a list of picture links under the back/next princible between the links (ie. no need to go back to the list page). I'm not sure if this requires a regular server file listing or does it work on "any page".


    The problem of many JavaScript sites is the ignorance of more than one or two browsers. Too often code is only tested on IE6, which in turns has tons on "unstandardized", proprietary features.

  10. #10
    Moderator
    Join Date
    Jan 2005
    Location
    Sydney
    Posts
    13,621

    Re: Simple HTML command.. _blank window size?

    Quote Originally Posted by Merri
    Not very friendly today, are we?
    No. Sorry, I was being a *****. But I still recommend that you take the time to learn Javascript properly if you ever want to use it. I hate seeing it abused the way it is in copy and paste script websites.

  11. #11
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: Simple HTML command.. _blank window size?

    But doesn't that behavior depend inherently on the fact that a browser has tabs? It's too... (I can't find the right word) of an assumption for users.

    Alright, let's consider this scenario. A person is reading a news article. There is a link there, that says "Send this article to a friend." User clicks on it. Generally, I see that a popup window opens, the user fills in about two or three fields, clicks submit, and the popup closes. The user can continue reading. If no popups, what would you suggest as an alternative that does not involve AJAX? Navigation flow is also important on websites. Having a page redirect to 'send.php', and then back to the news article is not appealing.

  12. #12
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Simple HTML command.. _blank window size?

    Doesn't your method make too much of an assumption for users to have a browser with JavaScript enabled, support for popup windows and not having an effective popup blocker...

    I guess you get the point? You have to assume something; personally I'd prefer assuming as much as you can, as many different possibilities possible. For that particular case I'd start making a working solution that wouldn't require JavaScript at all - and that would involve not opening a popup window, because you can't make it cleanly without JS. It would force to reload the page though, atleast if we'd stay within valid strict HTML. Other than that, I'd display a box over the link when mouse hovers on it (disabling the possibility to actually click on it) where user can fill the information.

    With JavaScript support, user would need to click the link to see the box (and the default CSS behavior is "disabled"). Without AJAX, it would then open a "hidden" popup into the background and load a page that processes the sent data and closes the popup. Or without popup it could depend to unvalid HTML such as IFRAME and do it with that. With AJAX, process more interactively with the server. In any case, there is no need to display a separate popup window that is set to fixed size.

    But as can be seen, a lot of this is arguable: there is no one best way to do things. A lot depends on if strict standards are followed or not. There is however always a clean way to do things that works in all cases.


    Yet... this solution doesn't have anything to do with displaying full size images. Whatever happens, with a browser that has support for tabs, I'd want default behavior for left click the open up the image in the same window, I wouldn't want to have a popup. Because a popup for an image is highly annoying. Middle click should open into a new tab. There could be a separate button for opening a new window for the image. Give the user possibilities, rely on default behavior and give other features as an extra. And remember that soon most users are indeed using a browser with tabs as IE7 is shipping this year.

  13. #13
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: Simple HTML command.. _blank window size?

    What I've always thought is, there are no properly defined concepts. It's more of a subjective debate isn't it? For example I can say that more browsers will have javascript than have tabs. And I don't consider them the same thing. Tabs are unknown to html/javascript. It's a user-defined behavior, rather than something that can be manipulated by code. Popups are code-defined. Though the users can block it. See the difference?

    So yeah, I do agree with that bit... there is no one best way to do anything.

  14. #14
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Simple HTML command.. _blank window size?

    But in this case, users do have a choice to open a link to a new window if they want: there is a choice for that in the right click menu. You can provide an alternative link as well.

    Popups are more or less a hack in JavaScript (HTML or CSS have no idea about other windows) much like frames are a hack of old in HTML. And interestingly, both are built on same interaction assumption, although both are different technologies. It reeks too much like a workaround solution, too much like a hack. There are security issues related into the popup windows, as well.

    Also, where you say tabs are user-defined behavior (ie. user has the choice how to work with the link), isn't a popup forced behavior (user has no choice)?
    Last edited by Merri; Sep 12th, 2006 at 06:15 AM.

  15. #15
    Moderator
    Join Date
    Jan 2005
    Location
    Sydney
    Posts
    13,621

    Re: Simple HTML command.. _blank window size?

    Just link to the picture normally and let the user/user agent deal with it however they please.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.