homepage Welcome to WebmasterWorld Guest from 54.242.200.172
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Visit PubCon.com
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?
Alina




msg:602601
 10:42 am on May 29, 2004 (gmt 0)

Hello

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

Alina

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

 

py9jmas




msg:602602
 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">).

mbauser2




msg:602603
 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.

Alina




msg:602604
 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

Alina

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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved