Item1157: Base tag should be self closing in pattern skin header

pencil
Priority: Low
Current State: Closed
Released In: 1.1.0
Target Release: minor
Applies To: Extension
Component: PatternSkin
Branches:
Reported By: DrewStevenson
Waiting For:
Last Change By: KennethLavrsen
html base tag in templates/foswiki.pattern.tmpl should be self closing or ff3 and safari complain.

diff for foswiki.pattern.tmpl


@@ -41,3 +41,3 @@
 <meta name="robots" content="noindex" />%HTTP_EQUIV_ON_VIEW%
-<base href="%SCRIPTURL{%SCRIPTNAME%}%/%WEB%/%TOPIC%"></base>
+<base href="%SCRIPTURL{%SCRIPTNAME%}%/%WEB%/%TOPIC%" />
 %TMPL:P{"script"}%%TMPL:P{"defaultstyle"}%</head>%TMPL:END%

and while we're at it foswiki.tmpl


@@ -34,3 +34,3 @@
        <meta name="description" content="%TOPIC%" />
-    <base href="%SCRIPTURL{%SCRIPTNAME%}%/%WEB%/%TOPIC%"></base>
+    <base href="%SCRIPTURL{%SCRIPTNAME%}%/%WEB%/%TOPIC%" />
        %TMPL:P{"script"}%

-- DrewStevenson

Thanks for the fix.

Checked and checked in

-- KennethLavrsen - 26 Feb 2009

Reverted this fix.

In Internet Explorer 6 this self closing base tag causes the broswer not allow selecting text in the topic area. So people cannot copy text for pasting into emails or whatever. It is better that FF may be complaining in some deep inside place the end user never sees than having all IE6 users (a huge fraction of corporate users) have a very poorly working Foswiki.

If someone can find what it is that makes IE6 barf then we may be able to address this but for now reverting is the only option

-- KennethLavrsen - 27 Feb 2009

How about something like:

<!--[if IE]><base href="%SCRIPTURL{%SCRIPTNAME%}%/%WEB%/%TOPIC%"></base><![endif]-->
<!--[if !IE]>--><base href="%SCRIPTURL{%SCRIPTNAME%}%/%WEB%/%TOPIC%" /><!--<![endif]-->

Pulled the above out of http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=36516

Admittedly they claim it may not work.

-- DrewStevenson - 01 Mar 2009

As Michael Daum remarked by email: why don't we remove the base tag?

I agree, we don't use any relative urls like <img src="logo.gif">. We always use SCRIPTURLPATH or ATTACHURLPATH to create a relative path.

-- ArthurClemens - 01 Mar 2009

Would removing <base> change how anchors work?

-- DrewStevenson - 02 Mar 2009

As long as the path specified by the <base> element is the same as the actual URL of the document, then there will be no change in behaviour by removing it.

http://www.456bereastreet.com/archive/200608/base_elements_cause_text_selection_problems_in_ie/ is another reference to the bug (though without much more information). It might be related to the fact that in IE6, according to http://blogs.msdn.com/ie/archive/2005/08/29/457667.aspx, the <base> element was a container that included the subsequent elements. (So in fact closing it would break the capability of changing the base URL within the document in IE6 (though again in this case it would not matter).) -- IsaacLin - 02 Mar 2009

run a grep -R 'base href' . | grep -v '.svn' for a list of possible side effects to consider:

changed scope to 'trunk'

-- WillNorris - 13 May 2009

How about removing it. Browsers figure out the base for rel urls by themselves pretty well.

-- MichaelDaum - 14 May 2009

Just realized MichaelDaum had asked me... does removing base do anything to #Anchor references? Asked this earlier and see it was already answered. If it's going to break across browsers I vote to remove it.

-- DrewStevenson - 02 Oct 2009

See also: Item8937

-- PaulHarvey - 22 Apr 2010

Based on what I observed with Item8937 it seems as though the base tag is required for the TOC at least, so removing it to resolve this Task doesn't sound correct.

-- GeorgeClark - 11 May 2010

A solution is to insert an IE conditional tag:

<base href="%SCRIPTURL{%SCRIPTNAME%}%/%WEB%/%TOPIC%" /><!--[if IE]></base><![endif]-->

Apparently IE does not break on the self closing tag, as long as the extra </base> tag is there. Tested on IE6.

-- ArthurClemens - 14 Aug 2010

ItemTemplate edit

Summary Base tag should be self closing in pattern skin header
ReportedBy DrewStevenson
Codebase trunk
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Extension
Component PatternSkin
Priority Low
CurrentState Closed
WaitingFor
Checkins distro:793a65eac822 distro:6a4979e6f1be distro:28e2e66e6bb6 distro:3748738e4058
TargetRelease minor
ReleasedIn 1.1.0
Topic revision: r24 - 04 Oct 2010, KennethLavrsen
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy