Starting a second window

Discussion in 'HTML' started by Cogito, Feb 5, 2004.

  1. Cogito

    Cogito Guest

    On a web page I describe a puzzle and would like to have the word
    'Solution' as a hyperlink that will start a small window (on top of
    the previous screen) showing the solution page. What is the code for
    this?
     
    Cogito, Feb 5, 2004
    #1
    1. Advertising

  2. Cogito

    Steve R. Guest

    Cogito wrote in message ...
    > On a web page I describe a puzzle and would like to have the word
    > 'Solution' as a hyperlink that will start a small window.


    Try this markup below. Change the width and height figures to suit the size
    ot the window you wish to open.

    Copy it to notepad and save it as 'new_window.htm' (or whatever), then try
    it to make modifications as you require.

    <html>
    <head>
    <title></title>

    <script language="JavaScript">
    <!--
    function MM_openBrWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);
    }
    //-->
    </script>
    </head>

    <body>

    <a href="javascript:;"
    onClick="MM_openBrWindow('YOUR_HTM_PAGE_URL','','width=400,height=300')">So
    lution</a>

    </body>
    </html>
     
    Steve R., Feb 5, 2004
    #2
    1. Advertising

  3. Cogito wrote:
    > On a web page I describe a puzzle and would like to have the word
    > 'Solution' as a hyperlink that will start a small window (on top of
    > the previous screen) showing the solution page. What is the code for
    > this?


    It's my browser window, not yours. Just have a normal link.
     
    Leif K-Brooks, Feb 5, 2004
    #3
  4. Cogito

    Cogito Guest

    On Thu, 05 Feb 2004 09:14:23 GMT, "Steve R."
    <stevie_ritchie(NOSPAM)@hotmail.com> wrote:

    >Cogito wrote in message ...
    >> On a web page I describe a puzzle and would like to have the word
    >> 'Solution' as a hyperlink that will start a small window.

    >
    >Try this markup below. Change the width and height figures to suit the size
    >ot the window you wish to open.
    >
    >Copy it to notepad and save it as 'new_window.htm' (or whatever), then try
    >it to make modifications as you require.
    >
    ><html>
    ><head>
    ><title></title>
    >
    ><script language="JavaScript">
    ><!--
    >function MM_openBrWindow(theURL,winName,features) { //v2.0
    > window.open(theURL,winName,features);
    >}
    >//-->
    ></script>
    ></head>
    >
    ><body>
    >
    ><a href="javascript:;"
    >onClick="MM_openBrWindow('YOUR_HTM_PAGE_URL','','width=400,height=300')">So
    >lution</a>
    >
    ></body>
    ></html>
    >


    Thank you very much.
     
    Cogito, Feb 5, 2004
    #4
  5. Cogito

    Steve R. Guest

    Leif K-Brooks wrote in message ...
    > It's my browser window, not yours. Just have a normal link.


    There are exceptions to that rule and in this case it was a good idea to
    have a small *requested* pop-up window as a solution.
     
    Steve R., Feb 5, 2004
    #5
  6. Cogito

    Cogito Guest

    On Thu, 05 Feb 2004 09:14:23 GMT, "Steve R."
    <stevie_ritchie(NOSPAM)@hotmail.com> wrote:

    >Cogito wrote in message ...
    >> On a web page I describe a puzzle and would like to have the word
    >> 'Solution' as a hyperlink that will start a small window.

    >
    >Try this markup below. Change the width and height figures to suit the size
    >ot the window you wish to open.
    >
    >Copy it to notepad and save it as 'new_window.htm' (or whatever), then try
    >it to make modifications as you require.
    >
    ><html>
    ><head>
    ><title></title>
    >
    ><script language="JavaScript">
    ><!--
    >function MM_openBrWindow(theURL,winName,features) { //v2.0
    > window.open(theURL,winName,features);
    >}
    >//-->
    ></script>
    ></head>
    >
    ><body>
    >
    ><a href="javascript:;"
    >onClick="MM_openBrWindow('YOUR_HTM_PAGE_URL','','width=400,height=300')">So
    >lution</a>
    >
    ></body>
    ></html>
    >


    When I click on the Solution link the status bar shows only
    javascript:;
    and nothing opens... is there a comma or somthing else missing
    somewhere?
     
    Cogito, Feb 5, 2004
    #6
  7. Cogito

    Steve R. Guest

    Cogito wrote in message...
    > When I click on the Solution link the status bar shows only
    > javascript:;
    > and nothing opens... is there a comma or somthing else missing
    > somewhere?


    Did you *copy and paste* it to notepad and save it as an htm file or did
    you try and copy staright to a web-building program?

    It's essential to copy to notepad first to remove the formatting from your
    browser.

    I've just tried it and it works ok. IE6.
     
    Steve R., Feb 5, 2004
    #7
  8. Cogito

    DU Guest

    Steve R. wrote:

    > Cogito wrote in message ...
    >
    >>On a web page I describe a puzzle and would like to have the word
    >>'Solution' as a hyperlink that will start a small window.

    >
    >
    > Try this markup below. Change the width and height figures to suit the size
    > ot the window you wish to open.
    >
    > Copy it to notepad and save it as 'new_window.htm' (or whatever), then try
    > it to make modifications as you require.
    >
    > <html>
    > <head>
    > <title></title>
    >
    > <script language="JavaScript">
    > <!--
    > function MM_openBrWindow(theURL,winName,features) { //v2.0
    > window.open(theURL,winName,features);
    > }
    > //-->
    > </script>
    > </head>
    >
    > <body>
    >
    > <a href="javascript:;"
    > onClick="MM_openBrWindow('YOUR_HTM_PAGE_URL','','width=400,height=300')">So
    > lution</a>
    >
    > </body>
    > </html>
    >
    >


    As coded, the requested popup will have no scrollbar(s) if needed: that
    is, there will be no scrollbar(s) even if the content overflows
    requested window dimensions. So, that popup has an usability flaw.
    As coded, the requested popup will not be resizable: in no way, this can
    promote usability and accessibility to the content.
    As coded, clicking the *link* will not open the page at all if
    javascript is disabled.
    As coded, clicking the link will not disable the default action of the
    link. So, after opening the window, browsers will try to execute
    "javascript:;" and they won't succeed: the result will be that the popup
    will lose focus and the user won't understand what happened.
    As coded, clicking the link will not bring back focus to the requested
    popup if it lost focus: this is a very frequent usability burden
    encountered by coding popups.
    As coded, if the user wants to open the link in a new tab (via
    contextmenu of right-click), he will not succeed.
    As coded, the properties of the link will only indicate "javascript:;"
    as the link and will inform the user that the link will be opened in the
    *same* window: so even the browser will be confused and will return a
    false information.
    As coded, the provided solution uses invalid markup code and will
    interfere with users who wish to control how such link will be opened.

    Most (if not all) of these difficulties, problems, burdens would have
    been prevented by either coding the link to open a requested popup in a
    thorough manner or by simply coding the link like a normal link, e.g.:

    <a href="YOUR_HTM_PAGE_URL">Solution</a>

    and letting the user use his contextmenu commands like he wishes.

    DU
     
    DU, Feb 5, 2004
    #8
  9. Cogito

    Steve R. Guest

    DU wrote in message ...
    > As coded, the requested popup will have no scrollbar(s) if needed: that
    > is, there will be no scrollbar(s) even if the content overflows
    > requested window dimensions. So, that popup has an usability flaw.


    Look - If the *solution* to his puzzle ... whatever, is just one word or a
    graphic, then a small pop-up window with the *solution* will be more than
    adequate.

    He's able to size the pop-up to fit his answer. The user is able to move
    the pop-up around to compare the answer with the user's own efforts ...
    easy.

    Why do others have to make things so complicated when a simple answer
    serves?

    The OP hopefully knows what he's doing. Even if he doesn't, at least when
    we see the final result we can critic.
     
    Steve R., Feb 5, 2004
    #9
  10. Cogito

    Mark Parnell Guest

    On Thu, 05 Feb 2004 16:50:39 GMT, "Steve R."
    <stevie_ritchie(NOSPAM)@hotmail.com> declared in alt.html:

    > He's able to size the pop-up to fit his answer. The user is able to move
    > the pop-up around to compare the answer with the user's own efforts ...
    > easy.


    But how does he know how much room the answer will take at the user's
    chosen font size?

    >
    > Why do others have to make things so complicated when a simple answer
    > serves?


    Because the answer promotes bad coding practices, and either won't work
    at all or won't work properly for many people.

    >
    > The OP hopefully knows what he's doing. Even if he doesn't, at least when
    > we see the final result we can critic.


    In cases like this, chances are we wouldn't see the end result. The OP
    would go away, find that it works for him/her and assume it will work
    for everyone else.

    Even if we were going to see the end result, surely it is better to get
    the OP to do it right in the first place?

    --
    Mark Parnell
    http://www.clarkecomputers.com.au
     
    Mark Parnell, Feb 5, 2004
    #10
  11. Cogito

    DU Guest

    Steve R. wrote:

    > DU wrote in message ...
    >
    >>As coded, the requested popup will have no scrollbar(s) if needed: that
    >>is, there will be no scrollbar(s) even if the content overflows
    >>requested window dimensions. So, that popup has an usability flaw.

    >
    >
    > Look - If the *solution* to his puzzle ... whatever, is just one word or a
    > graphic, then a small pop-up window with the *solution* will be more than
    > adequate.
    >


    As coded, *your code* will not work for 8% to 12% of all users out there
    who have javascript support disabled. No word in a popup. No graphic in
    a popup. Nothing. Zero. Nil.

    There is such a thing as abusing user's system resources, you see. Popup
    coding involves creating, building window frames, borders, toolbars,
    size, positioning, security, memory management, storing and retrieving
    persistent data, etc and popup code in browser executable involves lots
    of instruction code, just in case you ignore this. So, if you're going
    to suggest and support the popup approach, at the very least provide one
    that meets usability standards, accessibility guidelines and respect as
    much as possible user's system resources.
    If the solution to his puzzle is just 1 word or a graphic, then a popup
    is less justified and less justifiable as a solution.

    > He's able to size the pop-up to fit his answer.


    As coded, *your code* will annoy the user if the user needs to resized
    the popup, and this, for whatever reasons he would need/want to resize
    such popup. Often web designers do not consider browser default margins
    on the body element.
    If you believe the popup is correctly sized, then why do you fear making
    it resizable? What's the safe, cautious, flexible approach (from the
    user's perspective) to sizing a popup? To make it rigid and unresizable
    or to make it resizable?
    Why people are requested help on this then?
    "Unable to Maximize or Resize Internet Explorer Pop-Up Windows"
    http://support.microsoft.com/default.aspx?scid=kb;en-us;211068

    The user is able to move
    > the pop-up around to compare the answer with the user's own efforts ...
    > easy.
    >
    > Why do others have to make things so complicated when a simple answer
    > serves?
    >


    This is what you wrote in the "Open in new window ??......." thread just
    yesterday:
    "if you suspect the link doesn't open in a new window
    and you try the right-click option it still doesn't work if it's a
    javascript link, so when you realise you just close it and do a *normal*
    left-click."

    Now, for someone speaking of simple answer, simple solution that works,
    you certainly have your javascript understanding, explaining pretty
    twisted. You're entirely contradicting yourself: your code and your
    explanations are incoherent, inconsequent. You're coding a solution that
    you know creates problems!

    http://jibbering.com/faq/#FAQ4_24

    "When they want the destination to appear in a new page, they can use
    their browser's 'open in new window' command -- assuming, of course,
    that **the link is not a piece of code that interferes with the
    browser’s standard behavior.**"
    Top Ten Web-Design Mistakes of 2002
    6. JavaScript in Links
    http://www.useit.com/alertbox/20021223.html

    and that is exactly what the code you provided in this thread do.


    " * Don't use javascript: URLs
    Using a straight http: URL will allow any browser to access the
    link. If you want to use JavaScript for browsers that have JavaScript
    enabled, use the onMouseOver and onClick attributes of the <a href> tag.

    (...)

    * wrong:
    <a href="javascript:window.open(blah)">
    * right:
    <a href="foo.html" target="_blank" onClick="window.open(blah);
    return false">
    "
    http://www.panix.com/~aahz/javascript.html#remove


    > The OP hopefully knows what he's doing.


    Anyone could copy and paste a DreamWeaver function code, you know,
    without understanding its flaws, limitations, usability burden, without
    justification for its implementation.

    Even if he doesn't, at least when
    > we see the final result we can critic.
    >
    >


    You provided a complete webpage code, from <html> to </html> in this
    thread. And it had flaws and weaknesses that anyone could see and can
    verify all by himself.

    DU
     
    DU, Feb 5, 2004
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Neredbojias
    Replies:
    2
    Views:
    822
    Neredbojias
    Jul 1, 2006
  2. Juan Garcia
    Replies:
    2
    Views:
    122
    Juan Garcia
    Jul 31, 2003
  3. sentinel
    Replies:
    1
    Views:
    177
    kaeli
    Feb 16, 2004
  4. yelipolok
    Replies:
    4
    Views:
    282
    John W. Krahn
    Jan 27, 2010
  5. xhe
    Replies:
    1
    Views:
    138
    Randy Webb
    Feb 9, 2007
Loading...

Share This Page