Tuesday, January 30, 2007

IE7 Breaks Relative URLS

My own company's site has had huge problems lately because we did not include base href tags at the correct spot in all our code.

How many of you are noticing bad links, bad images, bad forms, that just do not work in IE7.

Especially if you have a page that has search engine friendly url's.

Well in order for those to work you must have the BASE Tag in a specific spot.


BASE Element--Internet Explorer 7 strictly enforces the BASE element rule, as documented in the HTML 4.01 standard. We no longer allow BASE tags outside of the HEAD of the document. The standard specifies that the base element must appear within the head of the document, before any elements that refer to an external source.


Which means every coldfusion page has to have a base href in it. Which can be a tad difficult, if you have different development, production, testing or q&a servers.

It kind of makes me wonder if this was a necessary for IE7 feature. Or if any of you have had other IE7 issues.

5 comments:

  1. Seens to me like you took that out of context.. (which we can't verify, since you didn't specify a source along with that quote)

    IE7 doesn't enforce the {base} element tag, but enforces it to be in {head}

    (i had to change those tags, because blogger blocks them)

    ReplyDelete
  2. It was a comment from Don Park's Daily Habbit

    Well I can not reveal my company's url without their permission.

    But I am trying to describe a situation, to both help inform others, as well as trying to see what solutions others have tried.

    The circumstances is where you are at a page that has search engine friendly url in the address bar.

    And the links, images, form elements all use relative links. If you do not include a base href tag, they will append their url's to the end of the current url.

    That is the problem I am having, and have heard of other's having.

    Does that add some clarity?

    ReplyDelete
  3. Anonymous5:28 PM

    Craig Rosenblum wrote:
    > Which means every coldfusion page
    > has to have a base href in it.
    > Which can be a tad difficult,
    > if you have different
    > development, production, testing
    > or q&a servers

    Hmm. I must be missing something. Why not simply use a few lines of code within application.cfm /.cfc to detect the current server's IP or name, and set a variable with that information. This can then be used to set the href attribute of your base tag, and can be used throughout your application for dozens of different purposes.

    This is one of the oldest tricks in the book of dynamic Web development and I can't imagine how you get by without doing it! I must be misunderstanding you?

    ReplyDelete
  4. Our problem was that we couldn't set the basehref in our original html, but in the coldfusion code that get's run below it.

    So we were using cfheader to add the basehref.

    But with IE7, the base href tag has to be right near the top of the head tag.

    Then it will work.

    Although I am currently working to make sure all links are absolute, just in case.

    ReplyDelete
  5. These comments have been invaluable to me as is this whole site. I thank you for your comment.

    ReplyDelete