TYPO3: external page url, open external links in a new window by default
I am looking for a solution to open external menu links in a new default window. (no _blank entry in the target field) But without changing the url, the url should be bigger, like ..... /test.html not ... www.external-url.co .....
I've already tried
in typoscript
config.extTarget = _blank
in constants
styles.content.links.extTarget = _blank
But without success. Thank you for your help.
source to share
If you need to open external URLs in the menu in a new window, please check and try the below text:
lib.mainmenu = HMENU
lib.mainmenu {
special = directory
special.value = 1
1=TMENU
1.wrap=<ul>|</ul>
1.NO {
# do not create a link here else there are double <a> tags
doNotLinkIt = 1
wrapItemAndSub=<li>|</li>
stdWrap.cObject = CASE
stdWrap.cObject {
key.field = doktype
default = TEXT
default {
field = title
typolink.parameter.field = uid
stdWrap.htmlSpecialChars = 1
}
# 3 = external url
3 = TEXT
3 {
field = title
typolink.parameter.field = url
typolink.extTarget = _blank
}
}
}
}
source to share
The Sankar version can be simplified and if the given "target" item will take the value of the field.
lib.mainmenu = HMENU
lib.mainmenu{
entryLevel = 0
1 = TMENU
1{
expAll = 1
wrap = <ul>|</ul>
NO = 1
NO.wrapItemAndSub = <li>|</li>
NO.ATagParams{
override = target="_blank"
override.if{
isFalse.field = target
equals = 3
value.field = doktype
}
}
ACT < .NO
ACT.ATagParams.noTrimWrap = |class="active" ||
}
}
source to share
It worked for me this way:
I went to the Template module, then to the site home page (home page)
Then I selected the "custom object browser" and did a search for "extTarget" in "costants" and clicked on the result and there it was possible to change the target.
I saved it and it worked out well!
source to share