jaymc Posted October 20, 2008 Share Posted October 20, 2008 I used base ref in my html documents, however, this renders anchor links useless e.g. <a href="#top">Top</a> That will just go to the document root and add #top after the URL Searched around on google and seems to be a known problem but cant seem to find anyone with a solution where as I can use both successfully Any ideas? Quote Link to comment Share on other sites More sharing options...
dropfaith Posted October 20, 2008 Share Posted October 20, 2008 The base element, which is contained in the head of the document, provides a method for defining the base URL for all links and form submissions on a page. It also provides a common target (in the form of a named window) for all of these links or form submissions. This element isn’t used very often these days, as making links is usually a simple case of creating links to documents relative to the web server root, like so: I've published my <a href="/travel-writing/">holiday diaries</a>, including the <a href="/travel-writing/prague/2006/day2.html">crazy bone church at Kutna Hora</a> why would you use those? but anyways im thinking you could just do from base Base being included in this== http://www.imagesbytroy.com <a href="/pricing.php#general">Top</a> something like that Quote Link to comment Share on other sites More sharing options...
jaymc Posted October 20, 2008 Author Share Posted October 20, 2008 Cheers, I think I'll just scrap base ref Will have to add "/" at the start of all my links though, yawn Thanks Quote Link to comment Share on other sites More sharing options...
obsidian Posted October 20, 2008 Share Posted October 20, 2008 why would you use those? Base href can be very useful when working in the confines of a larger scale system (such as a CMS) when different environments are needed. For instance, in a preview or dev environment, being able to set the base href to a location where all scratch versions of pages (and everything else, for that matter) reside can be extremely useful. Additionally, if you set all the links in an application to the web root by using absolute paths, you run into the problem of that application always having to be installed at the web root. Setting the base href can be very useful to overcome this challenge by allowing the base href to be a configuration variable so that all links within a given code base will reference the same base. So, as you can see, there are definitely viable reasons to use the tag, although it is definitely not always the best solution for path fixes, especially when using in-page anchors. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.