User tests: Successful: Unsuccessful:
Pull Request for Issue #9010
Remove tag from html document.
Check the conversation on #22565
Check html code on front-end. After patch the <base>
tag is missing.
There is no <base>
tag. Anchor links works if you are on page with a query like ...?start=2
.
The <base>
tag exists, but if you are on page with a query like ...?start=2
then anchor does not work correctly and reload the page.
The <base>
tag has been removed from HTML version of the document.
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Title |
|
||||||
Labels |
Added:
?
|
surely without the base relative URLs wont work correctly?
it will work even better
Relative URLs (relative to the <base>
tag) are links that:
/
.
or ..
or index.php
or ?page=...
or #hash
or text/...
Relative URLs (relative to the domain) are links that:
/
, mainly used in joomlaNow, take a look at the example when joomla set the base tag URL as http://www.example.com/category/1-article
on page http://www.example.com/category/1-article
.
/
(slash) does not use the base tag.http://www.example.com/category/1-article?start=10
) - it will reload pagehttp://www.example.com/category/1-article/
) point to the virtual folder.It would be better to set the base URL as the same as current page, ex http://www.example.com/category/1-article?start=10
but then browser does not need the base tag.
Then, the anchor href="#hash"
will work even with query parameters in the page URL.
The alternative solution is #22565.
Then, the anchor won't work but we can use the base URL to generate links to css, images and javascript like media/system/jquery...
instead of
/media/system/jquery...
/prefixToJoomlaInstallation/media/system/jquery...
- if you install joomla in subfolder/~user/prefixToJoomlaInstallation/media/system/jquery...
- if you install joomla on a Linux user accountTo remove the base tag, you can add to your template index.php
(somewhere at the top) the php code
JFactory::getDocument()->setBase('');
and then test if your website still works.
And for the sites installed as subdirectories, what kind of havoc does this bring?
AFAIK missing the base tag is equal to the base URL as Uri::getInstance()
, but now Joomla use Uri::current()
.
The difference is that now (before patch) the base tag URL does not contain URL query.
Currently, the base tag URL AFAIK is not useful anywhere in joomla core. There is no havoc.
Personally I use solution from #22565 (JFactory::getDocument()->setBase(JUri::root());
) to fix a problem when an extension use only index.php
in html code.
<form action="index.php"><input name="option" value="com_...">...</form>
.
When I use #22565 it always point to http://domain.com/index.php
(in my develop version to http://localhost/~csthomas/joomla3/index.php
).
Without it, the action URL will point to http://domain.com/category/index.php
if I am on http://domain.com/category/1-article
.
These two versions works but I do not like to see weird links like http://company.com/news/people/index.php
.
#22565 will bring one issue, the anchor like <a href="#hash">...</a>
will always reload the page.
Currently, Joomla only reload the page when there is a query in page URL.
Honestly, at this point I'm leaning toward "change it in 4.0 and leave 3.x alone". It's a change in API behavior that's been there for 10 years and if we're going to change it then we really need to make sure that it doesn't come with major side effects.
I'm the wrong person to ask, I haven't written code that touches or relies on a <base>
tag probably ever.
Hmm, I suppose no one wants to answer.
While I checked WordPress, Drupal, TYPO3 and ... they do not use the base tag at all.
I will leave this PR open for a while.
It's not that I don't want to help here, I just don't have the knowledge to say anything useful on the topic and any answer I have would probably be something you've already stumbled on in your own search.
I am grateful that you joined the discussion, everything is fine.
The base-tag is broken since nearly forever I think.
The Joomla links only work thanks to the SEO plugin, which do some Voodoo with all the links/images/applets etc. so they ignore the base tag.
So I personal think, that, if the base tag should be changed in any way, then it should be repaired not removed. Means:
This would solve some problems with JS and update of html content (inject images via JS)
@bembelimen I understand you are voting for point 2 (# 22565)
I just tested this on one of my live sites. After applying the patch I can confirm that the base tag is no longer present
However - after applying the patch
All menu links are now non-sef
All direct links (eg manually created) display the home page even if the url in the address bar has changed
All bookmarked links display the home page even if the url in the address bar has changed
I have tested this item
I didn't test anchor links as there was no point with such a big failure
@brianteeman I do not know how you test it, but I can not believe in all your arguments.
You probably do something more that only add a patch from this PR. This PR remove only one html tag.
I can understand that it may affect to manually created links without the slash prefix like news/my-article
.
Never mind, I'm closing to save us time.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-10-18 09:44:38 |
Closed_By | ⇒ | csthomas |
I can assure you that the only thing I changed on the live site was the code here in this pr
Is removing base tag in J4 still considered ?
or it will not happen there either ?
I would like to see it in J4.
surely without the base relative urls wont work correctly?