No Code Attached Yet bug
avatar rytechsites
rytechsites
4 Jun 2024

Steps to reproduce the issue

Create a custom field - URL
Allow for RELATIVE LINKS

Expected result

If you put in an INTERNAL URL as the URL (relative link) it should open in the Current Browser, and not in a new browser.

Actual result

On the click of the URL Field it always opens in a NEW TAB (even if it is an internal link)

System information (as much as possible)

Joomla 4.4.5
PHP 8

Additional comments

Here is the actual code:
if (!Uri::isInternal($value)) {
$attributes = ' rel="nofollow noopener noreferrer" target="blank"';
$text = Text::
('JVISIT_WEBSITE');
} else {
$text = Text::_('JVISIT_LINK');
}

It seems that in the code it is 'hardcoded' to always use _blank

  1. although it 'asks' if URL is internal, even if you use a referential link (./sss/jkdf) when this code is run the URL is already 'the full url', so the system does not know that it is internal
avatar rytechsites rytechsites - open - 4 Jun 2024
avatar rytechsites rytechsites - change - 4 Jun 2024
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 4 Jun 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 4 Jun 2024
avatar brianteeman
brianteeman - comment - 4 Jun 2024

Ignoring the fact that target="_blank" should never be forced

I can confirm that if the field is set to use relative urls then the isInternal check will never pass so the target will be added.

If you do NOT use relative urls then the isInternal check does work

avatar rytechsites
rytechsites - comment - 4 Jun 2024

Yes IsInternal does work if it is external. But if it is an internal link then it does not work. Is that what you are saying Brian?

Also I don't see the TARGET variable that you can define in the custom field build being referenced. Should it be? Similar to how you can select the target in a menu item?

thanks,
Laura


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43616.

avatar brianteeman
brianteeman - comment - 4 Jun 2024

Yes IsInternal does work if it is external. But if it is an internal link then it does not work. Is that what you are saying Brian?

Not quite.
If you have configured the field not to use relative urls then isinternal does work
if you have configured the field to use relative urls then isinternal does not work

Also I don't see the TARGET variable that you can define in the custom field build being referenced. Should it be? Similar to how you can select the target in a menu item?

It's hard coded and as you point out correctly it should not be

avatar rytechsites
rytechsites - comment - 5 Jun 2024

Ok, got it. Interesting not sure why I would 'not use relative' when it is an internal link... since that would be the purpose of using relative URLs, so I can use an internal link within the site.

Do you know what the variable is for 'target' that is defined in the form? I could create a temporary override just for now until we have the fix.

-- Laura


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43616.

avatar rytechsites
rytechsites - comment - 6 Jun 2024

It seems that the 'TARGET' is not part of core joomla, but there is still a bug...

I'm going to edit the request.

avatar rytechsites rytechsites - change - 6 Jun 2024
The description was changed
avatar rytechsites rytechsites - edited - 6 Jun 2024
avatar Quy Quy - change - 7 Jun 2024
Labels Added: bug
avatar Quy Quy - labeled - 7 Jun 2024

Add a Comment

Login with GitHub to post a comment