Forum Moderators: open

Message Too Old, No Replies

override base href

in an email

         

jo1ene

3:17 am on Dec 22, 2005 (gmt 0)

10+ Year Member



Possibly a stupid question... I dunno. I am sending an HTML newletter from my CMS. It inserts the header info by default, among which is a base href URL. The problem is when I want to put an anchor based contents menu in the email (#letter, #news, etc.) it arrives in the email box with TOC links referencing the base url of the website eg. http://www.example.com/#news which is NOT what I want. When I take out the base href, certain other links break, which is also not what I want. Is there a way to "override" the base href for just the contents, so that the base will be the email? I would do it in a web page by typing out the full URL, but that's not applicable here. I am also under the impression that using base href is the correct thing to do with HTML emails. If so, then how the heck does one use anchors?

I am testing my newsletter in Thunderbird and Yahoo.

[edited by: tedster at 3:31 am (utc) on Dec. 23, 2005]
[edit reason] de-link the example link [/edit]

jo1ene

4:00 am on Dec 22, 2005 (gmt 0)

10+ Year Member



Upon doing some more research, I find that this is a common (known) problem and the only proposed solution I was was to not use base href or not do html emails. Not really helpful.

tedster

4:08 am on Dec 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would do it in a web page by typing out the full URL, but that's not applicable here.

Can you explain a bit more why isn't using an absolute url isn't option? At first glance, this seems to me like the simplest way through the tangle.

jo1ene

4:44 pm on Dec 22, 2005 (gmt 0)

10+ Year Member



Because I want the TOC link to go to the anchor in the email - NOT to a webpage. There's no absolute URL to an email. Anchors work fine in the email if I take out the base href, but then the links back to the site to unsubscribe and the archives break. Since the latter is dynamically generated, I can't really hard-code them.

Receptional Andy

4:59 pm on Dec 22, 2005 (gmt 0)



Could you include an additional base href below the current one (you could perhaps use javascript to write this with the current file's URL)?

jo1ene

9:28 pm on Dec 22, 2005 (gmt 0)

10+ Year Member



I don't want another base href. There is no file. It's an email. Aw heck. The more I read, the more I start to think there is no solution.

tedster

11:10 pm on Dec 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think what many are missing here is that you are looking for a "link" to go to a named anchor <a name=""> within the email.

So what is your CMS inserting? You need to remove that, correct? Is the CMS designed to create an email, or are you adapting it to that purpose?

I am also under the impression that using base href is the correct thing to do with HTML emails.

Maybe -- but I don't really understand why. base href is useful when you are using relative links within the email that actually go to a web page. But if you use absolute links for web page targets, then <base href=""> is redundant, and messes up links to named anchors within the email itself.

When I take out the base href, certain other links break, which is also not what I want.

These are the links that need to be absolute, not relative.

jo1ene

3:05 am on Dec 23, 2005 (gmt 0)

10+ Year Member



I think what many are missing here is that you are looking for a "link" to go to a named anchor <a name=""> within the email.

Right.

So what is your CMS inserting? You need to remove that, correct? Is the CMS designed to create an email, or are you adapting it to that purpose?

It's using the some of the same functions to prepare an email as it would a regular page. It's relying on code from elsewhere, hence I can't hardcode too much.

Maybe -- but I don't really understand why. base href is useful when you are using relative links within the email that actually go to a web page. But if you use absolute links for web page targets, then <base href=""> is redundant, and messes up links to named anchors within the email itself.

That's what I was trying to explain.

These are the links that need to be absolute, not relative.

Exactly. But they are generated by the CMS as relative links becasue the sytem expects a base href to be there. Like I said, causes problems with an email. The HTML emails work fine, until I tried the TOC, named anchor, links whatever, etc.

Like I said,I'm not the only one with this problme. How do you liek this one, I tried adding bold text. Now thunderbird craps out in plain text mode and makes everything bold and breaks all the links. Ack! I give up.

I need a drink...