force to refresh browser

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

    force to refresh browser

    I'm trying to refresh browser when some new information is available in DB.
    is there any way to force to refresh browser?
    Thanks.

    -Kev



  • kaeli

    #2
    Re: force to refresh browser

    In article <bpdmsu$df5$1@m sunews.cl.msu.e du>, no@spam.com enlightened us
    with...[color=blue]
    > I'm trying to refresh browser when some new information is available in DB.
    > is there any way to force to refresh browser?
    > Thanks.
    >[/color]


    window.location .reload(true);

    Beware infinite refresh if not in a function!

    --
    ~kaeli~
    Is it possible to be totally partial?



    Comment

    • Jay

      #3
      Re: force to refresh browser

      Thanks!

      well, window.location .reload(true) does whenever control is hit that line,
      it does refresh.
      What I want to do is server side trigger send message to client browser to
      refresh it.

      -Kev



      "kaeli" <tiny_one@NOSPA M.comcast.net> wrote in message
      news:MPG.1a2425 a2bcf0f48c98997 e@nntp.lucent.c om...[color=blue]
      > In article <bpdmsu$df5$1@m sunews.cl.msu.e du>, no@spam.com enlightened us
      > with...[color=green]
      > > I'm trying to refresh browser when some new information is available in[/color][/color]
      DB.[color=blue][color=green]
      > > is there any way to force to refresh browser?
      > > Thanks.
      > >[/color]
      >
      >
      > window.location .reload(true);
      >
      > Beware infinite refresh if not in a function!
      >
      > --
      > ~kaeli~
      > Is it possible to be totally partial?
      > http://www.ipwebdesign.net/wildAtHeart
      > http://www.ipwebdesign.net/kaelisSpace
      >[/color]


      Comment

      • kaeli

        #4
        Re: force to refresh browser

        In article <bpdrs7$ht0$1@m sunews.cl.msu.e du>, no@spam.com enlightened us
        with...[color=blue]
        > Thanks!
        >
        > well, window.location .reload(true) does whenever control is hit that line,
        > it does refresh.
        > What I want to do is server side trigger send message to client browser to
        > refresh it.
        >[/color]

        Technically, you can't in a normal cross-browser internet environment
        (that is, activeX, applets, and COM notwithstanding ).

        If the page should be refreshed every so often, put it in a setTimeout.
        This is common.

        If the user updates the DB via a popup with the main window on a
        particular page you want to refresh, write a script as output to the
        popup that calls window.opener.l ocation.reload( true).

        Other situation, please elaborate. We can probably find something that
        works for you.

        --
        ~kaeli~
        A backward poet writes... inverse.



        Comment

        • Jay

          #5
          Re: force to refresh browser

          Thank you for your help.
          I'm displaying hotel information from DB.

          What I want to is
          First, I will get the hotel list and display with no rate. ( since getting
          rate takes time)
          Whenever rate information is ready to update. refresh user's browser.

          but how?

          Thanks.
          -Kev





          "kaeli" <tiny_one@NOSPA M.comcast.net> wrote in message
          news:MPG.1a243f fb568759c998998 2@nntp.lucent.c om...[color=blue]
          > In article <bpdrs7$ht0$1@m sunews.cl.msu.e du>, no@spam.com enlightened us
          > with...[color=green]
          > > Thanks!
          > >
          > > well, window.location .reload(true) does whenever control is hit that[/color][/color]
          line,[color=blue][color=green]
          > > it does refresh.
          > > What I want to do is server side trigger send message to client browser[/color][/color]
          to[color=blue][color=green]
          > > refresh it.
          > >[/color]
          >
          > Technically, you can't in a normal cross-browser internet environment
          > (that is, activeX, applets, and COM notwithstanding ).
          >
          > If the page should be refreshed every so often, put it in a setTimeout.
          > This is common.
          >
          > If the user updates the DB via a popup with the main window on a
          > particular page you want to refresh, write a script as output to the
          > popup that calls window.opener.l ocation.reload( true).
          >
          > Other situation, please elaborate. We can probably find something that
          > works for you.
          >
          > --
          > ~kaeli~
          > A backward poet writes... inverse.
          > http://www.ipwebdesign.net/wildAtHeart
          > http://www.ipwebdesign.net/kaelisSpace
          >[/color]


          Comment

          • kaeli

            #6
            Re: force to refresh browser

            In article <bpe1vp$no9$1@m sunews.cl.msu.e du>, no@spam.com enlightened us
            with...[color=blue]
            > Thank you for your help.
            > I'm displaying hotel information from DB.
            >
            > What I want to is
            > First, I will get the hotel list and display with no rate. ( since getting
            > rate takes time)
            > Whenever rate information is ready to update. refresh user's browser.
            >
            > but how?
            >[/color]

            If you are getting the hotel list from the DB, getting the rate should
            take an inconsequential amount of time, especially if the DB is set up
            properly and a concise SQL statement is used. Views can be helpful for
            this if the rate is a calculated field or is keyed by a number rather
            than a hotel name.
            Rates do not change often enough to need to refresh the user's browser
            more than with a setTimeout for some amount of time.
            Perhaps what you really need is help with your SQL query.

            If you're not getting the hotel list from the DB, why not? That is much
            easier than manually changing pages. :)
            The DB must have the hotels in there or it would be impossible to look
            up rates.

            How I would do this: query the DB for the list of hotels and rates and
            write the whole thing dynamically at once. I do much more complicated
            things with billing data for one of my pages and it takes less than 10
            seconds to run and load.

            --
            ~kaeli~
            Not one shred of evidence supports the notion that life is
            serious.



            Comment

            • Jay

              #7
              Re: force to refresh browser

              Thanks.

              I did not explained in detail so I can avoid some confusions.
              But I guess it did more harm than good.

              Hotel list are coming from our DB and rate are coming from GDS in XML.
              I have a java object created with list first and displays and trying to
              update as soon as I got XML response.

              XML response is quite slow. ( you know there is nothing I can do).
              I can wait XML and display all together. but I'm just seeking a way to
              display list of hotel first with some animation indicating
              rate is being updated and display rate when it's available.

              is that make sense now?

              -Kev




              "kaeli" <tiny_one@NOSPA M.comcast.net> wrote in message
              news:MPG.1a2534 68f5aba90998998 5@nntp.lucent.c om...[color=blue]
              > In article <bpe1vp$no9$1@m sunews.cl.msu.e du>, no@spam.com enlightened us
              > with...[color=green]
              > > Thank you for your help.
              > > I'm displaying hotel information from DB.
              > >
              > > What I want to is
              > > First, I will get the hotel list and display with no rate. ( since[/color][/color]
              getting[color=blue][color=green]
              > > rate takes time)
              > > Whenever rate information is ready to update. refresh user's browser.
              > >
              > > but how?
              > >[/color]
              >
              > If you are getting the hotel list from the DB, getting the rate should
              > take an inconsequential amount of time, especially if the DB is set up
              > properly and a concise SQL statement is used. Views can be helpful for
              > this if the rate is a calculated field or is keyed by a number rather
              > than a hotel name.
              > Rates do not change often enough to need to refresh the user's browser
              > more than with a setTimeout for some amount of time.
              > Perhaps what you really need is help with your SQL query.
              >
              > If you're not getting the hotel list from the DB, why not? That is much
              > easier than manually changing pages. :)
              > The DB must have the hotels in there or it would be impossible to look
              > up rates.
              >
              > How I would do this: query the DB for the list of hotels and rates and
              > write the whole thing dynamically at once. I do much more complicated
              > things with billing data for one of my pages and it takes less than 10
              > seconds to run and load.
              >
              > --
              > ~kaeli~
              > Not one shred of evidence supports the notion that life is
              > serious.
              > http://www.ipwebdesign.net/wildAtHeart
              > http://www.ipwebdesign.net/kaelisSpace
              >[/color]


              Comment

              • kaeli

                #8
                Re: force to refresh browser

                In article <bpg1ei$2j5i$1@ msunews.cl.msu. edu>, no@spam.com enlightened
                us with...[color=blue]
                > I did not explained in detail so I can avoid some confusions.
                > But I guess it did more harm than good.
                >
                > Hotel list are coming from our DB and rate are coming from GDS in XML.
                > I have a java object created with list first and displays and trying to
                > update as soon as I got XML response.
                >
                > XML response is quite slow. ( you know there is nothing I can do).
                > I can wait XML and display all together. but I'm just seeking a way to
                > display list of hotel first with some animation indicating
                > rate is being updated and display rate when it's available.
                >
                > is that make sense now?
                >[/color]

                Yes, much.

                Okay, there really isn't a good way that I know of (cross-browser) to do
                this. If you're using IE only (intranet application) let me know,
                because you have more options. Generally speaking, once the page is
                written, the server knows nothing else about it. It can't refresh the
                browser, because the connection is over. COM and ActiveX are exceptions,
                but are IE only (AFAIK).

                Anyway, the way I would handle this is with an "invisible" iframe
                (styled to hidden or 1px by 1px the same background color as the main
                page). I would have the iframe wait for the XML, then when it is
                received, update the encompassing page. This doesn't require a refresh,
                just DHTML.
                That still requires NN6+/IE5+ and other browsers that support
                iframes/DHTML, but it's better than IE only. Last I checked at my site,
                95% of my viewers had browsers that were IE5+ or compatible (opera can
                spoof this so be careful).

                Do your target users have updated browsers? Do they have permissions to
                update their browsers if they need to (i.e. people at schools and
                libraries do not.)?

                I'm sure there are other ways to handle this, such as applets, COM,
                ActiveX, etc, but all require knowing quite a bit about your users'
                browsers. For example, using an applet is a bad idea if your users
                access the site from public facilities, since they don't have permission
                to install an updated JVM should they need to.

                --
                ~kaeli~
                A plateau is a high form of flattery.



                Comment

                • Jay

                  #9
                  Re: force to refresh browser

                  do you have any iframe sample I can look?
                  or please direct me to web site I can get some info from.
                  Thanks again.

                  -Kev


                  "kaeli" <tiny_one@NOSPA M.comcast.net> wrote in message
                  news:MPG.1a2550 811825f98398998 9@nntp.lucent.c om...[color=blue]
                  > In article <bpg1ei$2j5i$1@ msunews.cl.msu. edu>, no@spam.com enlightened
                  > us with...[color=green]
                  > > I did not explained in detail so I can avoid some confusions.
                  > > But I guess it did more harm than good.
                  > >
                  > > Hotel list are coming from our DB and rate are coming from GDS in XML.
                  > > I have a java object created with list first and displays and trying to
                  > > update as soon as I got XML response.
                  > >
                  > > XML response is quite slow. ( you know there is nothing I can do).
                  > > I can wait XML and display all together. but I'm just seeking a way to
                  > > display list of hotel first with some animation indicating
                  > > rate is being updated and display rate when it's available.
                  > >
                  > > is that make sense now?
                  > >[/color]
                  >
                  > Yes, much.
                  >
                  > Okay, there really isn't a good way that I know of (cross-browser) to do
                  > this. If you're using IE only (intranet application) let me know,
                  > because you have more options. Generally speaking, once the page is
                  > written, the server knows nothing else about it. It can't refresh the
                  > browser, because the connection is over. COM and ActiveX are exceptions,
                  > but are IE only (AFAIK).
                  >
                  > Anyway, the way I would handle this is with an "invisible" iframe
                  > (styled to hidden or 1px by 1px the same background color as the main
                  > page). I would have the iframe wait for the XML, then when it is
                  > received, update the encompassing page. This doesn't require a refresh,
                  > just DHTML.
                  > That still requires NN6+/IE5+ and other browsers that support
                  > iframes/DHTML, but it's better than IE only. Last I checked at my site,
                  > 95% of my viewers had browsers that were IE5+ or compatible (opera can
                  > spoof this so be careful).
                  >
                  > Do your target users have updated browsers? Do they have permissions to
                  > update their browsers if they need to (i.e. people at schools and
                  > libraries do not.)?
                  >
                  > I'm sure there are other ways to handle this, such as applets, COM,
                  > ActiveX, etc, but all require knowing quite a bit about your users'
                  > browsers. For example, using an applet is a bad idea if your users
                  > access the site from public facilities, since they don't have permission
                  > to install an updated JVM should they need to.
                  >
                  > --
                  > ~kaeli~
                  > A plateau is a high form of flattery.
                  > http://www.ipwebdesign.net/wildAtHeart
                  > http://www.ipwebdesign.net/kaelisSpace
                  >[/color]


                  Comment

                  • kaeli

                    #10
                    Re: force to refresh browser

                    In article <bpghd4$31ij$1@ msunews.cl.msu. edu>, no@spam.com enlightened
                    us with...[color=blue]
                    > do you have any iframe sample I can look?
                    > or please direct me to web site I can get some info from.
                    > Thanks again.
                    >[/color]

                    Tested in NN7.1 and IE6.0 successfully.

                    test1.htm
                    <html>
                    <head>
                    <title>Untitl ed Document</title>
                    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                    </head>

                    <body>
                    <p>This is a test page with an iframe that fills in the form below.</p>
                    <form name="form1" method="post" action="">
                    <p>item 1:&nbsp;&nbsp;
                    <input name="item1" type="text" id="item1">
                    </p>
                    <p>item 2:&nbsp;&nbsp;
                    <input name="item2" type="text" id="item2">
                    </p>
                    <p>item 3:&nbsp;&nbsp;
                    <input name="item3" type="text" id="item3">
                    </p>
                    </form>
                    <iframe height="1px" width="1px" src="test2.htm" style="top:-
                    50;position:abs olute;"></iframe>
                    </body>
                    </html>


                    test2.htm
                    <html>
                    <head>
                    <title>Untitl ed Document</title>
                    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                    </head>

                    <body>
                    This is the contents of the iframe for test1.html
                    <script type="text/javascript">
                    top.document.fo rm1.item1.value ="hi there";
                    top.document.fo rm1.item2.value ="this is from an iframe";
                    top.document.fo rm1.item3.value ="boo!";

                    </script>
                    </body>
                    </html>

                    --
                    ~kaeli~
                    Dijon vu - the same mustard as before.



                    Comment

                    • Jay

                      #11
                      Re: force to refresh browser

                      Thanks, Kaeli,

                      I see how iframe works.
                      However, I do not understand how ifram helps my situation.

                      Do I constantly refresh test1.htm?

                      -kev

                      "kaeli" <tiny_one@NOSPA M.comcast.net> wrote in message
                      news:MPG.1a2591 6488ff1e3e98998 e@nntp.lucent.c om...[color=blue]
                      > In article <bpghd4$31ij$1@ msunews.cl.msu. edu>, no@spam.com enlightened
                      > us with...[color=green]
                      > > do you have any iframe sample I can look?
                      > > or please direct me to web site I can get some info from.
                      > > Thanks again.
                      > >[/color]
                      >
                      > Tested in NN7.1 and IE6.0 successfully.
                      >
                      > test1.htm
                      > <html>
                      > <head>
                      > <title>Untitl ed Document</title>
                      > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                      > </head>
                      >
                      > <body>
                      > <p>This is a test page with an iframe that fills in the form below.</p>
                      > <form name="form1" method="post" action="">
                      > <p>item 1:&nbsp;&nbsp;
                      > <input name="item1" type="text" id="item1">
                      > </p>
                      > <p>item 2:&nbsp;&nbsp;
                      > <input name="item2" type="text" id="item2">
                      > </p>
                      > <p>item 3:&nbsp;&nbsp;
                      > <input name="item3" type="text" id="item3">
                      > </p>
                      > </form>
                      > <iframe height="1px" width="1px" src="test2.htm" style="top:-
                      > 50;position:abs olute;"></iframe>
                      > </body>
                      > </html>
                      >
                      >
                      > test2.htm
                      > <html>
                      > <head>
                      > <title>Untitl ed Document</title>
                      > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                      > </head>
                      >
                      > <body>
                      > This is the contents of the iframe for test1.html
                      > <script type="text/javascript">
                      > top.document.fo rm1.item1.value ="hi there";
                      > top.document.fo rm1.item2.value ="this is from an iframe";
                      > top.document.fo rm1.item3.value ="boo!";
                      >
                      > </script>
                      > </body>
                      > </html>
                      >
                      > --
                      > ~kaeli~
                      > Dijon vu - the same mustard as before.
                      > http://www.ipwebdesign.net/wildAtHeart
                      > http://www.ipwebdesign.net/kaelisSpace
                      >[/color]


                      Comment

                      • Jay

                        #12
                        Re: force to refresh browser

                        Anyway, the way I would handle this is with an "invisible" iframe
                        (styled to hidden or 1px by 1px the same background color as the main
                        page). I would have the iframe wait for the XML, then when it is
                        received, update the encompassing page. This doesn't require a refresh,
                        just DHTML.


                        "update the encompassing page" I don't know how to do that..

                        Thanks.





                        "Jay" <no@spam.com> wrote in message
                        news:bpihst$1sp b$1@msunews.cl. msu.edu...[color=blue]
                        > Thanks, Kaeli,
                        >
                        > I see how iframe works.
                        > However, I do not understand how ifram helps my situation.
                        >
                        > Do I constantly refresh test1.htm?
                        >
                        > -kev
                        >
                        > "kaeli" <tiny_one@NOSPA M.comcast.net> wrote in message
                        > news:MPG.1a2591 6488ff1e3e98998 e@nntp.lucent.c om...[color=green]
                        > > In article <bpghd4$31ij$1@ msunews.cl.msu. edu>, no@spam.com enlightened
                        > > us with...[color=darkred]
                        > > > do you have any iframe sample I can look?
                        > > > or please direct me to web site I can get some info from.
                        > > > Thanks again.
                        > > >[/color]
                        > >
                        > > Tested in NN7.1 and IE6.0 successfully.
                        > >
                        > > test1.htm
                        > > <html>
                        > > <head>
                        > > <title>Untitl ed Document</title>
                        > > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                        > > </head>
                        > >
                        > > <body>
                        > > <p>This is a test page with an iframe that fills in the form below.</p>
                        > > <form name="form1" method="post" action="">
                        > > <p>item 1:&nbsp;&nbsp;
                        > > <input name="item1" type="text" id="item1">
                        > > </p>
                        > > <p>item 2:&nbsp;&nbsp;
                        > > <input name="item2" type="text" id="item2">
                        > > </p>
                        > > <p>item 3:&nbsp;&nbsp;
                        > > <input name="item3" type="text" id="item3">
                        > > </p>
                        > > </form>
                        > > <iframe height="1px" width="1px" src="test2.htm" style="top:-
                        > > 50;position:abs olute;"></iframe>
                        > > </body>
                        > > </html>
                        > >
                        > >
                        > > test2.htm
                        > > <html>
                        > > <head>
                        > > <title>Untitl ed Document</title>
                        > > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                        > > </head>
                        > >
                        > > <body>
                        > > This is the contents of the iframe for test1.html
                        > > <script type="text/javascript">
                        > > top.document.fo rm1.item1.value ="hi there";
                        > > top.document.fo rm1.item2.value ="this is from an iframe";
                        > > top.document.fo rm1.item3.value ="boo!";
                        > >
                        > > </script>
                        > > </body>
                        > > </html>
                        > >
                        > > --
                        > > ~kaeli~
                        > > Dijon vu - the same mustard as before.
                        > > http://www.ipwebdesign.net/wildAtHeart
                        > > http://www.ipwebdesign.net/kaelisSpace
                        > >[/color]
                        >
                        >[/color]


                        Comment

                        • kaeli

                          #13
                          Re: force to refresh browser

                          In article <bpiijm$1tih$1@ msunews.cl.msu. edu>, no@spam.com enlightened
                          us with...[color=blue]
                          > Anyway, the way I would handle this is with an "invisible" iframe
                          > (styled to hidden or 1px by 1px the same background color as the main
                          > page). I would have the iframe wait for the XML, then when it is
                          > received, update the encompassing page. This doesn't require a refresh,
                          > just DHTML.
                          >
                          >
                          > "update the encompassing page" I don't know how to do that..
                          >[/color]

                          The pages I gave you show that. test2 updates test1. I used a form for
                          ease and quickness, but you could do any block-level element.

                          What you do is have the query / xml run in what was my test2.htm. When
                          it loads, the xml is done. When it loads, have the script write to what
                          was my test1.htm.


                          --
                          ~kaeli~
                          The man who fell into an upholstery machine is fully
                          recovered.



                          Comment

                          • Jay

                            #14
                            Re: force to refresh browser

                            then Until test2 is fully updated user is not seeing test1?

                            Well, my task is while user watching test1.
                            updates test2 and when update test2 is done refresh test1.
                            so user can see updated info.

                            is user has to wait test2 is updated and while doing updating, user don't
                            see any info.
                            It is kinda same as before.





                            "kaeli" <tiny_one@NOSPA M.comcast.net> wrote in message
                            news:MPG.1a2699 564a37003098999 6@nntp.lucent.c om...[color=blue]
                            > In article <bpiijm$1tih$1@ msunews.cl.msu. edu>, no@spam.com enlightened
                            > us with...[color=green]
                            > > Anyway, the way I would handle this is with an "invisible" iframe
                            > > (styled to hidden or 1px by 1px the same background color as the main
                            > > page). I would have the iframe wait for the XML, then when it is
                            > > received, update the encompassing page. This doesn't require a refresh,
                            > > just DHTML.
                            > >
                            > >
                            > > "update the encompassing page" I don't know how to do that..
                            > >[/color]
                            >
                            > The pages I gave you show that. test2 updates test1. I used a form for
                            > ease and quickness, but you could do any block-level element.
                            >
                            > What you do is have the query / xml run in what was my test2.htm. When
                            > it loads, the xml is done. When it loads, have the script write to what
                            > was my test1.htm.
                            >
                            >
                            > --
                            > ~kaeli~
                            > The man who fell into an upholstery machine is fully
                            > recovered.
                            > http://www.ipwebdesign.net/wildAtHeart
                            > http://www.ipwebdesign.net/kaelisSpace
                            >[/color]


                            Comment

                            • kaeli

                              #15
                              Re: force to refresh browser

                              In article <bpinhb$21vg$1@ msunews.cl.msu. edu>, no@spam.com enlightened
                              us with...[color=blue]
                              > then Until test2 is fully updated user is not seeing test1?
                              >[/color]

                              No, they see it.

                              That's the point of the iframe.

                              --
                              ~kaeli~
                              Murphy's Law #3020: Quality assurance doesn't.



                              Comment

                              Working...