Announcement

Collapse
No announcement yet.

Wrote a Chat Room Using Sessions. Refresh/Scroll Question??

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wrote a Chat Room Using Sessions. Refresh/Scroll Question??

    Is it possible to have a page refresh and scroll to the bottom automatically?

    If so, please let me know how? I can get the chat room to refresh ok, but it will not scroll to the bottom of the page each time.
    http://www.BaylorFans.com

  • #2
    Try using <a name="bottom">, and then refresing to chat.php#bottom

    Comment


    • #3
      Yeah, I tried that.

      It worked for me once and for some reason it would only refresh once. When it did refresh once it would scroll to the bottom. The problem is its only refreshing once.

      Basically what I need is for this to keep refreshing and scrolling to the bottom each time.

      See try this link...
      http://www.baylorfans.com/test.html#bottom

      See if it refreshes for you and scrolls down more than once.

      Thanks
      http://www.BaylorFans.com

      Comment


      • #4
        i thought there was a javascript method that lets you scroll wherever you want... something like window.scrollTo(x, y), check the javascript documentation

        Then again, the anchor idea would probably be more widely supported

        Comment


        • #5
          It worked the first time, but it didn't work after that.

          I don't know if it'll work, but you can try something like this:
          PHP Code:
          <?php
          if (eregi("#bottom"$_SERVER['QUERY_STRING'])) {
              
          header("Location: chat.php#bottom2");
          } else {
              
          header("Location: chat.php#bottom");
          }
          ?>
          Maybe that would work, if you had two different <a name=""></a>

          Comment


          • #6
            <?php
            if (strstr('#bottom', $_SERVER['QUERY_STRING'])) {
            header("Location: chat.php#bottom2");
            } else {
            header("Location: chat.php#bottom");
            }
            ?>

            is faster
            Last edited by megahard; Wed 21 Aug '02, 3:15pm.

            Comment


            • #7
              Thanks guys! It works great!

              I am not sure what is up with Netscape, but I have version 4.79 and it won't even let me log into the chat room. I know somebody else that uses a newer version of Netscape and he can get in. I am thinking that Netscape is not very good at handling sessions?
              http://www.BaylorFans.com

              Comment


              • #8
                Netscape has all sorts of cookie rules about numbers and sizes, I wouldn't be surprised if there was a conflict somewhere in there.

                Comment


                • #9
                  Originally posted by megahard
                  <?php
                  if (strstr('#bottom', $_SERVER['QUERY_STRING'])) {
                  header("Location: chat.php#bottom2");
                  } else {
                  header("Location: chat.php#bottom");
                  }
                  ?>

                  is faster
                  The #something isn't part of the query string... the server doesn't even receive that...

                  Comment


                  • #10
                    Originally posted by MUG
                    The #something isn't part of the query string... the server doesn't even receive that...
                    Well then where DOES it belong? URLs go in the order of URI, query string, page anchor (or whatever they're called).

                    http://www.thehardwire.com/news/inde...te&order=asc#1 is an example

                    Comment


                    • #11
                      The browser handles it, not the server... check out a phpinfo() page to see for yourself.

                      Comment


                      • #12
                        When I asked "where DOES it belong", that was a question How do you get it, PHP_SELF ?

                        Comment


                        • #13
                          The server doesn't actually receive that part, it is handled by the client's browser.

                          Comment


                          • #14
                            Originally posted by MUG
                            The #something isn't part of the query string... the server doesn't even receive that...
                            sorry i didnt realise he'd put query string:


                            <?php
                            if (strstr('#bottom', $_SERVER['HTTP_REFERER'])) {
                            header("Location: chat.php#bottom2");
                            } else {
                            header("Location: chat.php#bottom");
                            }
                            ?>

                            Comment


                            • #15
                              Did you try that way and, if you did, did it work?

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...
                              X