#1 2016-07-07 20:19:33

federico
Member
Registered: 2016-01-25
Posts: 12

[Solved] Page as external link - Open in a new tab?

Hello Ionize community,
simple question: in the ionize cms page dashboard, the link area allow only to paste an external href link, but then when you click it on the website navigation menu it redirect on the same tab.

This workaround does not work: http://www.mysite.com/" target="_blank

Any proper solution to this? 
thnak you!

best

Last edited by federico (2016-07-17 18:04:36)

Offline

#2 2016-07-14 21:11:47

adaliszk
Ionize Friend
From: Germany
Registered: 2010-09-20
Posts: 397
Website

Re: [Solved] Page as external link - Open in a new tab?

the target="_blank" should work fine, here is my currently used code:

<ion:navigation>
<a href="<ion:url>" <?php if(strpos("<ion:url />","<ion:base_url />") === FALSE): ?>target="_blank"<?php endif; ?>> <ion:title /> </a>
</ion:navigaton>

Webdeveloper, Programmer, Application developer, Ionize friend
@adaliszk

Offline

#3 2016-07-17 14:33:11

federico
Member
Registered: 2016-01-25
Posts: 12

Re: [Solved] Page as external link - Open in a new tab?

Hi Adamos,
thank you for your input. I was trying also this workaround but even if we give target blank to specific navigation <a> html tag (your code above), when you click on it on the website menu, the linked webpage will both open the new link on the same page as well as on a new browser tab.

So far, no solution to open a menu link to a new page while preserving the current page as it is?

Thanks
fede

Offline

#4 2016-07-17 14:41:50

adaliszk
Ionize Friend
From: Germany
Registered: 2010-09-20
Posts: 397
Website

Re: [Solved] Page as external link - Open in a new tab?

Thats behavior is odd, which browser do you use and what javascript do things on your navigation?

From default the browsers upon clicking an <a> tag reading the href and the target defaulting _self and fetch the request and change the page or adding a new browser context. See the attributes of the <a> tag: https://www.w3.org/TR/html-markup/a.html

There is no way that a browser open a new tab and open in self the link if no javascript involved. Your site has some javascript code which does not prevent the default behavior and navigating the page to the href without checking the target.


Webdeveloper, Programmer, Application developer, Ionize friend
@adaliszk

Offline

#5 2016-07-17 18:03:42

federico
Member
Registered: 2016-01-25
Posts: 12

Re: [Solved] Page as external link - Open in a new tab?

You're right Adamos, after disabling js in chrome I've found the script that was opening href in the same page.
And your script above does the job correctly. Much appreciated.

So solved issue (although this option could be added to Ionize cms dashboard).
Best!

Offline

#6 2016-07-17 18:05:29

adaliszk
Ionize Friend
From: Germany
Registered: 2010-09-20
Posts: 397
Website

Re: [Solved] Page as external link - Open in a new tab?

federico wrote:

So solved issue (although this option could be added to Ionize cms dashboard).

You mean a <ion:target/> element in the navigation which can be autodetect and set on the admin?


Webdeveloper, Programmer, Application developer, Ionize friend
@adaliszk

Offline

#7 2016-07-17 23:56:33

federico
Member
Registered: 2016-01-25
Posts: 12

Re: [Solved] Page as external link - Open in a new tab?

I meant like adding an option in cms that allow the user to choose whether the link slot (page as link area) should behave as target _blank (new page) or relink to the same browser tab.
The code you suggested, which actually works, could be considered as workaround for the time being.
Not that relevant overall but just a little suggestion

Here the correct code (the above one has some typos in it):

<ion:navigation>
<a href="<ion:url />" <?php if(strpos("<ion:url />","<ion:base_url />") === FALSE): ?>target="_blank"<?php endif; ?>> <ion:title /> </a>
</ion:navigation>

Last edited by federico (2016-07-22 15:32:25)

Offline

#8 2016-09-02 20:39:05

blondie63
Member
Registered: 2015-04-28
Posts: 12

Re: [Solved] Page as external link - Open in a new tab?

Federico, i'm new on ionizecms, which file i've to modify with your code ?:

<ion:navigation>
<a href="<ion:url />" <?php if(strpos("<ion:url />","<ion:base_url />") === FALSE): ?>target="_blank"<?php endif; ?>> <ion:title /> </a>
</ion:navigation>

Thanks

Mauro

Offline

#9 2016-09-03 08:47:59

adaliszk
Ionize Friend
From: Germany
Registered: 2010-09-20
Posts: 397
Website

Re: [Solved] Page as external link - Open in a new tab?

blondie63 wrote:

which file i've to modify with your code ?

The view file where you have the ion:navigation tag.


Webdeveloper, Programmer, Application developer, Ionize friend
@adaliszk

Offline

#10 2016-09-03 16:52:47

blondie63
Member
Registered: 2015-04-28
Posts: 12

Re: [Solved] Page as external link - Open in a new tab?

I've some double because a friend done my template..
I've found on header.php this code:

            <div class="nav-collapse collapse" style="text-transform:uppercase;">
                <ion:tree_navigation depth="1" tag="ul" class="nav pull-right" active_class="active" />
            </div>

Is this code that create menu ?
My site is: https://www.harleydavidsonvicenza.com/

How can i modify with  your code to open on blank page / tab

Thanks for help

Offline

#11 2016-09-04 11:32:06

blondie63
Member
Registered: 2015-04-28
Posts: 12

Re: [Solved] Page as external link - Open in a new tab?

Solved with this code:

<ion:navigation depth="1" tag="ul" class="nav pull-right" active_class="active">
        <li<ion:is_active> class="active"</ion:is_active>>
		<a href="<ion:url />" <?php if(strpos("<ion:url />","<ion:base_url />") === FALSE): ?>target="_blank"<?php endif; ?>> <ion:title /> </a>
	</li>
</ion:navigation>

Offline

What's Ionize ?

Ionize is an Open Source Content Management System created by webdesigners for webdesigners.

Created and maintained by Partikule and Toopixel, Ionize wants to be the easiest and most powerful CMS.

Can I help ?

Because talent is nothing without involvement, we are looking for motivated coders and webdesigners to join the project team.

Resources

Website : ionizecms.com
Documentation : doc.ionizecms.com

Development : Ionize on GitHub
Translations : Ionize Translations