Close browser/window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Graham

    #1

    Close browser/window

    What I currently have is a page that opens another browser at 800x600, once
    that is loaded I would like to close the orginal page down while keeping the
    page that it has just opened open (To make it more clear take a look at
    http://www.ithorizon.co.uk).

    I have inserted some code below to show what I currently have, but I don't
    have the knowledge to amend it, can somone please help.


    <SCRIPT LANGUAGE="JavaS cript">
    closetime = 0; // Close window after __ number of seconds?
    // 0 = do not close, anything else = number of seconds

    function Start(URL, WIDTH, HEIGHT) {
    windowprops = "left=100,top=5 0,width=" + WIDTH + ",height=" + HEIGHT;
    preview = window.open(URL , "preview", windowprops);
    if (closetime) setTimeout("pre view.close();", closetime*1000) ;
    }

    function doPopup() {
    url = "frame.html ";
    width = 800; // width of window in pixels
    height = 600; // height of window in pixels
    delay = 3; // time in seconds before popup opens
    timer = setTimeout("Sta rt(url, width, height)", delay*1000);
    }
    </script>


    Many thanks,

    Graham



  • Ivo

    #2
    Re: Close browser/window

    "Graham" <graham@mr2oc.c o.uk_NOSPAM> wrote in message
    news:403f5756$0 $42$cc9e4d1f@ne ws.dial.pipex.c om...[color=blue]
    > What I currently have is a page that opens another browser at 800x600,[/color]
    once[color=blue]
    > that is loaded I would like to close the orginal page down while keeping[/color]
    the[color=blue]
    > page that it has just opened open (To make it more clear take a look at
    > http://www.ithorizon.co.uk).[/color]

    Popups aren't a very popular subject in this newsgroup, and if one would
    even manage to close the originating window (which it won't), that popup
    would die a thousand painful deaths on as many computer screens.
    The reason it won't is that if the parent window was not created by your
    script, your script does not have the permission to silently bin it. If I
    add the line

    window.close()

    as the last command in your function Start(), which is one way of doing it,
    my IE browser generates this confirm box:
    "A script on this page is trying to close the window.
    Do you want to close this window?"
    at which point also people who are not regular to this newsgroup will start
    wondering why all this is necessary. Bottom-line: leave the window (or
    windows) to the user, they know best how they want to navigate their way
    through your site. If you think your site is special and users need
    directions, give them, suggest that they close the opener - in plain text.
    If you make clear the benefit of doing so, they will.
    HTH
    Ivo

    [color=blue]
    > I have inserted some code below to show what I currently have, but I don't
    > have the knowledge to amend it, can somone please help.
    >
    >
    > <SCRIPT LANGUAGE="JavaS cript">
    > closetime = 0; // Close window after __ number of seconds?
    > // 0 = do not close, anything else = number of seconds
    >
    > function Start(URL, WIDTH, HEIGHT) {
    > windowprops = "left=100,top=5 0,width=" + WIDTH + ",height=" + HEIGHT;
    > preview = window.open(URL , "preview", windowprops);
    > if (closetime) setTimeout("pre view.close();", closetime*1000) ;
    > }
    >
    > function doPopup() {
    > url = "frame.html ";
    > width = 800; // width of window in pixels
    > height = 600; // height of window in pixels
    > delay = 3; // time in seconds before popup opens
    > timer = setTimeout("Sta rt(url, width, height)", delay*1000);
    > }
    > </script>
    >
    >
    > Many thanks,
    >
    > Graham
    > http://www.ithorizon.co.uk
    >
    >[/color]


    Comment

    • Graham

      #3
      Re: Close browser/window

      Thanks for getting back to me on this.

      The reason I want to get rid of the index.html window once to other window
      opens is becouse it serves no purpose being there. Would it be a better idea
      to pop a bit of code on there that closes down the window after 10 seconds
      of it being open?

      I can't seem to find any code on that, would you be able to point me to a
      site where I can download it?

      Many thanks,

      Graham.


      "Ivo" <no@thank.you > wrote in message
      news:403f5fa3$0 $63122$a344fe98 @news.wanadoo.n l...[color=blue]
      > "Graham" <graham@mr2oc.c o.uk_NOSPAM> wrote in message
      > news:403f5756$0 $42$cc9e4d1f@ne ws.dial.pipex.c om...[color=green]
      > > What I currently have is a page that opens another browser at 800x600,[/color]
      > once[color=green]
      > > that is loaded I would like to close the orginal page down while keeping[/color]
      > the[color=green]
      > > page that it has just opened open (To make it more clear take a look at
      > > http://www.ithorizon.co.uk).[/color]
      >
      > Popups aren't a very popular subject in this newsgroup, and if one would
      > even manage to close the originating window (which it won't), that popup
      > would die a thousand painful deaths on as many computer screens.
      > The reason it won't is that if the parent window was not created by your
      > script, your script does not have the permission to silently bin it. If I
      > add the line
      >
      > window.close()
      >
      > as the last command in your function Start(), which is one way of doing[/color]
      it,[color=blue]
      > my IE browser generates this confirm box:
      > "A script on this page is trying to close the window.
      > Do you want to close this window?"
      > at which point also people who are not regular to this newsgroup will[/color]
      start[color=blue]
      > wondering why all this is necessary. Bottom-line: leave the window (or
      > windows) to the user, they know best how they want to navigate their way
      > through your site. If you think your site is special and users need
      > directions, give them, suggest that they close the opener - in plain text.
      > If you make clear the benefit of doing so, they will.
      > HTH
      > Ivo
      >
      >[color=green]
      > > I have inserted some code below to show what I currently have, but I[/color][/color]
      don't[color=blue][color=green]
      > > have the knowledge to amend it, can somone please help.
      > >
      > >
      > > <SCRIPT LANGUAGE="JavaS cript">
      > > closetime = 0; // Close window after __ number of seconds?
      > > // 0 = do not close, anything else = number of seconds
      > >
      > > function Start(URL, WIDTH, HEIGHT) {
      > > windowprops = "left=100,top=5 0,width=" + WIDTH + ",height=" + HEIGHT;
      > > preview = window.open(URL , "preview", windowprops);
      > > if (closetime) setTimeout("pre view.close();", closetime*1000) ;
      > > }
      > >
      > > function doPopup() {
      > > url = "frame.html ";
      > > width = 800; // width of window in pixels
      > > height = 600; // height of window in pixels
      > > delay = 3; // time in seconds before popup opens
      > > timer = setTimeout("Sta rt(url, width, height)", delay*1000);
      > > }
      > > </script>
      > >
      > >
      > > Many thanks,
      > >
      > > Graham
      > > http://www.ithorizon.co.uk
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Richard Cornford

        #4
        Re: Close browser/window

        Graham wrote: <403f6d18$0$29$ cc9e4d1f@news.d ial.pipex.com>[color=blue]
        > The reason I want to get rid of the index.html window once to other
        > window opens is becouse it serves no purpose being there.[/color]
        <snip>

        The window that the user used to navigate to index.html may not serve
        you any purpose but it does serve a purpose for the user. It is, for
        example, holding their browsing history, and they are going to want that
        in order to get back to their google search page to find themselves the
        next site on the list in the hope that it doesn't try to mess around
        with their browser windows.

        Richard.


        Comment

        • Graham

          #5
          Re: Close browser/window

          I suppose this is the sort of answer I was expecting to get earlier on. I
          want my site to look in a particular way, is that wrong? If the visiter
          don't like it then I'm sure they can go else where. I just can't see the
          point of having a window open if it has served its purpose in making the
          other window open.

          Graham.

          "Richard Cornford" <Richard@litote s.demon.co.uk> wrote in message
          news:c1ns39$nos $1$8302bc10@new s.demon.co.uk.. .[color=blue]
          > Graham wrote: <403f6d18$0$29$ cc9e4d1f@news.d ial.pipex.com>[color=green]
          > > The reason I want to get rid of the index.html window once to other
          > > window opens is becouse it serves no purpose being there.[/color]
          > <snip>
          >
          > The window that the user used to navigate to index.html may not serve
          > you any purpose but it does serve a purpose for the user. It is, for
          > example, holding their browsing history, and they are going to want that
          > in order to get back to their google search page to find themselves the
          > next site on the list in the hope that it doesn't try to mess around
          > with their browser windows.
          >
          > Richard.
          >
          >[/color]


          Comment

          • Randy Webb

            #6
            Re: Close browser/window

            Graham wrote:[color=blue]
            > I suppose this is the sort of answer I was expecting to get earlier on. I
            > want my site to look in a particular way, is that wrong? If the visiter
            > don't like it then I'm sure they can go else where. I just can't see the
            > point of having a window open if it has served its purpose in making the
            > other window open.[/color]


            Read the FAQ with regards to top-posting.

            There is lots to be said about doing research.

            One thing you are failing to realize is that a lot of people (I
            included) will never ever see your popup window. AOL's popup blocker is
            very adept at killing them, as are my other browsers. Now, when I go to
            your page I am going to see a blank window and thats it. So, thats how
            you "want your site to look"?

            And yes, I can close the browser anytime I want to - it has an X on it
            just for that purpose.

            Keeping my secrets to myself with regards to anything else - proud of me
            Richard? <g>

            --
            Randy
            Chance Favors The Prepared Mind
            comp.lang.javas cript FAQ - http://jibbering.com/faq/

            Comment

            • Ivo

              #7
              Re: Close browser/window


              "Graham" <graham@mr2oc.c o.uk_NOSPAM> wrote in message
              news:403f7d45$0 $31$cc9e4d1f@ne ws.dial.pipex.c om...[color=blue]
              > I suppose this is the sort of answer I was expecting to get earlier on. I
              > want my site to look in a particular way, is that wrong? If the visiter
              > don't like it then I'm sure they can go else where. I just can't see the
              > point of having a window open if it has served its purpose in making the
              > other window open.[/color]

              That is not its purpose. Its purpose is to continue showing pages after the
              user has seen what he wanted to see (or not).
              It has tremendous in value in that it is sized to a particular dimension and
              position on the screen that he thought best when he positioned it, it
              contains a history list which is unique to that window. You need to turn the
              question around, you really do: what purpose serves your popup window? Do
              you realize that more than 50 % of users (wild guess, I think I 'm
              conservative) have popup blocking software and won't have even a clue why
              your site is only a blank page if it doesn't at least say in plain text that
              its only "purpose" was to clone itself.
              HTH
              Ivo



              [color=blue]
              > Graham.
              >
              > "Richard Cornford" <Richard@litote s.demon.co.uk> wrote in message
              > news:c1ns39$nos $1$8302bc10@new s.demon.co.uk.. .[color=green]
              > > Graham wrote: <403f6d18$0$29$ cc9e4d1f@news.d ial.pipex.com>[color=darkred]
              > > > The reason I want to get rid of the index.html window once to other
              > > > window opens is becouse it serves no purpose being there.[/color]
              > > <snip>
              > >
              > > The window that the user used to navigate to index.html may not serve
              > > you any purpose but it does serve a purpose for the user. It is, for
              > > example, holding their browsing history, and they are going to want that
              > > in order to get back to their google search page to find themselves the
              > > next site on the list in the hope that it doesn't try to mess around
              > > with their browser windows.
              > >
              > > Richard.
              > >
              > >[/color]
              >
              >[/color]


              Comment

              • Richard Cornford

                #8
                Re: Close browser/window

                Graham wrote:[color=blue]
                > I suppose this is the sort of answer I was expecting to
                > get earlier on. I want my site to look in a particular way,
                > is that wrong?[/color]

                Inside the browser's viewport it is not wrong. It is probably
                unrealistic to actually expect it as "look" is not entirely under the
                control of the author. But whatever happens outside of the web page
                displaying part of the current browser instance is not really the
                business of the page author, that is up to the user.
                [color=blue]
                > If the visiter don't like it then I'm
                > sure they can go else where.[/color]

                Most web sites want visitors they don't serve much purpose themselves
                without them.
                [color=blue]
                > I just can't see the point of having a
                > window open if it has served its
                > purpose in making the other window open.[/color]

                You see the window as a vehicle for opening a new window, the user sees
                it as a piece of software that they opened and are using. Shutting it
                down without their consent is no different from someone walking up to
                your computer when you are 3/4 of the way through some complex task and
                pressing the power button. You don't know what you would be destroying
                with your proposed action so you cannot assess its value to the user.

                Richard.


                Comment

                • Richard Cornford

                  #9
                  Re: Close browser/window

                  Randy Webb wrote:
                  <snip>[color=blue]
                  > Keeping my secrets to myself with regards to anything
                  > else - proud of me Richard? <g>[/color]

                  LOL. Yes.

                  Well I wasn't going to tell ;-)

                  Richard.


                  Comment

                  • Lasse Reichstein Nielsen

                    #10
                    Re: Close browser/window

                    "Graham" <graham@mr2oc.c o.uk_NOSPAM> writes:
                    [color=blue]
                    > I suppose this is the sort of answer I was expecting to get earlier on. I
                    > want my site to look in a particular way, is that wrong?[/color]

                    The goal is not wrong (only misguided). The means are wrong. Changing
                    the browser's size or position is overstepping the limit of
                    hospitality. It will irritate the user. Often so will opening new
                    windows. Trying to close the current window is pretty darn rude,
                    destructive and bordering on unforgivable.
                    [color=blue]
                    > If the visiter don't like it then I'm sure they can go else where.[/color]

                    Except back, because you killed their browser window and its history.
                    Don't do that. It's not your window to close (even if you manage to
                    find a way to do it).
                    [color=blue]
                    > I just can't see the point of having a window open if it has served
                    > its purpose in making the other window open.[/color]

                    I think Richard Cornford was pretty clear: It *does* serve a purpose
                    for the user. It holds his history, which is worth more to him than
                    your site.

                    /L 'and please don't top post'
                    --
                    Lasse Reichstein Nielsen - lrn@hotpop.com
                    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
                    'Faith without judgement merely degrades the spirit divine.'

                    Comment

                    Working...