Forum Moderators: open

Message Too Old, No Replies

anchor in a META refresh

How do you move to an anchor in a META refresh

         

spatter

7:53 pm on Jun 20, 2003 (gmt 0)

10+ Year Member



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.
Thanks,
Spatter

tedster

2:20 am on Jun 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, spatter.

You may be correct about the named anchor being the problem -- have you tried removing the anchor from the meta refresh to see if that works?

If that doesn't fix it, then you know you need to look harder at your code (for instance, quotes in meta tags can get tricky.) If it does fix things, then you know you have zeroed in on the problem, but not the solution.

spatter

4:59 pm on Jun 21, 2003 (gmt 0)

10+ Year Member



I've worked around it. I removed the anchor from the META tag and added a onload=Scrollto JavaScript command to the body tag, that automatically scrolls you to the bottom.