homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Gold Sponsor 2015!
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

base URL and anchors
Is it possible for base URL and anchors to work together?

10+ Year Member

Msg#: 7984 posted 10:42 am on May 29, 2004 (gmt 0)


I am using base url within an HTML document - say http: //www.website.com/

I am also using anchors e.g <A name=Top></A> and later on down the HTML page <A href="#Top">Top of Page</A>

But the anchors are taken in relation to the base url and open a page "http://www.website.com/#Top". Is there a way for the base url to distinguishing between anchors within an HTML page and all other links?

Many thanks for an help received


[edited by: BlobFisk at 10:48 am (utc) on May 29, 2004]
[edit reason] Delinked example URL [/edit]



10+ Year Member

Msg#: 7984 posted 11:21 am on May 29, 2004 (gmt 0)

By setting the base you are instructing the browser to resolve all urls relative to that base. The browser is doing exactly what you're telling it to do.

If the page this is happening on is "http://www.website.com/foo.html", your links would have to be <a href="foo.html#Top"> so when resolved relative to the base, you get the answer you first thought of. Or you could use absolute urls (ie <a href="http://www.website.com/foo.html#Top">).


10+ Year Member

Msg#: 7984 posted 3:44 am on May 30, 2004 (gmt 0)

That's not an HTML problem; that's a browser problem. [example.com...] should be a valid URL.

Requesting a URL with a '#' is a two-step process: The browser requests the file (without a # or anything after it) from the server, then searches the returned file for the target anchor.


10+ Year Member

Msg#: 7984 posted 9:13 am on May 31, 2004 (gmt 0)

Thanks for your both your replies.

py9jmas: I am trying to send the html within an email message. I could change the anchor link to foo.html#Top - which would work.

The only thing is when the anchor is clicked on - instead of scrolling within the actual email message - a new window gets opened.

I would like scrolling within the email message to be achieved. Is there any way that this could be done?

Many thanks


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved