Thread: Meta Tag with anchor
Results 1 to 15 of 19
06-20-2003, 02:52 PM #1
Meta Tag with anchor
I've built a lame little chat window using php, but that's not really much of an issue.
Here's what I'm trying to do. I'd like a page to auto-refresh every 15 seconds and immediately load to the bottom of the page (so you can see the last message posted).
Here's what I've tried. If I use this META tag <META HTTP-EQUIV="refresh" CONTENT="15; URL=message.php"> it will reload perfectly every 15 seconds. But I want it to jump to the bottom of the page.... so....
I added this anchor tag, <a name="btm">, to the bottom of the page and changed the META tag to <META HTTP-EQUIV="refresh" CONTENT="15; URL=message.php#btm">
That has a problem though. When I load the page, it recognizes the tag and after 15 seconds, it reloads the page and moves the view correctly to the anchor tag. But then it stops. It doesn't reload again.
My guess is that when the URL of the current page is message.php it recognizes the META tag, but when the URL is message.php#btm it doesn't read the META tag.
Any help would be appreciated.
06-20-2003, 03:19 PM #2
Hello, welcome to the forums.
06-20-2003, 03:31 PM #3
What does 'bob' represent? And if you set 'bob' equal to location.href, then it doesn't seem like the second line would be needed.... since they are now equal anyway.
Please elaborate on this.
06-20-2003, 03:54 PM #4
Sorry, Its my wierd way of refreshing my page.
works like this -
bob is just a variable
bob=location.href means that bob=www.quietdean.com for example.
now we tell the window to change its location to.. bob. in other words, reload the same page.
if you replace bob with something like thisPageLocation or similar, it makes more sense
06-20-2003, 03:56 PM #5
06-20-2003, 04:18 PM #6
Outstanding. I changed it to
and it's working like a champ.
Thanks a bunch,
06-20-2003, 04:22 PM #7
oh no... wait. it still has a problem.
It APPEARS to be refreshing the page. If I scroll up to the top, then after the few seconds it will jump back down to the bottom, but it isn't properly refreshing the content.
I think the page isn't refreshing, it's just jumping to the bottom.
06-20-2003, 04:27 PM #8
*removed* this wont work, see below
06-20-2003, 04:29 PM #9
also, try adding this to the head
<!-- no cache headers --> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="no-cache"> <meta http-equiv="Expires" content="-1"> <meta http-equiv="Cache-Control" content="no-cache"> <!-- end no cache headers -->
06-20-2003, 04:41 PM #10
window.location.reload( true );
But now I'm back to the problem of jumping to the bottom of the page. This new call doesn't realize that I want it to jump to the anchor.
06-20-2003, 04:47 PM #11
If it starts off without the #btn, then it wont work. How about if we start off with the #btn in the url? Will it refresh including the #btn then? If that works, you just have to make sure you always include the #btn in any links.
06-20-2003, 05:01 PM #12
Actually, the message.php page is being loaded as a frame within the index.html file. The index file contains:
<frame src="message.php#btm" name="middle">
06-20-2003, 05:02 PM #13
06-20-2003, 05:05 PM #14
06-20-2003, 05:17 PM #15
I see the scrollto(x, y) function. But all the examples I see are for scrolling back to the top. How would you go about finding the maximum y value you can use in the scrollto function?... such that it'll scroll to the furthest down.