This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have inherited an application that works in IE and FireFox, but doesn't work in Chrome or Safari. Or I should say it works, but any href links don't work. I have narrowed it down to the <html:base /> that I found on the page with all the links. If I remove this tag everything works. In all browsers the tag creates this base: <base href="https://ez.ewashtenaw.org/ess/common/layout/essLayout.jsp">. In all browsers the source for the links looks the same: <a href="ToShowTimesheet.do"> but in IE and FireFox the links are resolved as https://ez.ewashtenaw.org/ess/ToShowTimesheet.do while Chrome and Safari resolve them to https://ez.ewashtenaw.org/ess/common/layout/ToShowTimesheet.do. My first question is "Why the difference?" and my second is "Why is the base tag there?" I don't put the tag in any of my apps (which all work under Chrome and Safari). My Google searching is not coming up with any answers I find enlightening.
The base tag is used to specify what the prefix for all page-relative links should be. If you want that to be "https://ez.ewashtenaw.org/ess/" then that is what the base tag should specify. Otherwise, the page URL is used to determine the prefix.
Personally, I avoid page-relative URLs like the plague (at least for links) and make all my link URLs server-relative which leaves no room at all for ambiguity.
Joined: Jan 06, 2010
So the <http:base /> is resolving incorrectly? The way the page is formed is "common/layout/essLayout.jsp" is the base tiles definition. I also don't use tiles in my apps so I'm trying to figure out the tiles stuff too. Can I just take out the base tag? It doesn't seem to hurt anything when I do. What is the tag supposed to do for me?
If you're not going to be using the base tag's capabilities, there's no need for it to be on the page.
As I said, I never use page-relative URLs for links. They're just too fragile. I do find the base tag handy for resolving image and style sheet references in places where it is not possible to dynamically construct a server-relative URL though.
Joined: Jan 06, 2010
Thank you. I am going to take it out. It seems to be an easy fix and I need that right now.