user2735650
user2735650

Reputation:

External general link open in new window

How can I open all Sitecore external general links in a New Browser tab/window by default? And how can I force them to have just a New Browser option when I press Insert External Link.

Upvotes: 1

Views: 3203

Answers (3)

Thomas Therkildsen
Thomas Therkildsen

Reputation: 150

If you just want to remove the target="Active Browser" attribute from all links:

$('a[target="Active Browser"]').removeAttr('target');

Upvotes: 0

Trayek
Trayek

Reputation: 4410

If you already have external links on your website and you don't want to have to edit all of the existing ones, you can also do this with a bit of jQuery:

jQuery(function($) {
  $('a[href^="http://"],a[href^="https://"]')
  .not('[href*="mydomain.com"]')
  .click(function(e) {
    var url = this.href;
      e.preventDefault();
      window.open(url);
    })
});

Upvotes: 1

user459491
user459491

Reputation:

You need to modify next file :

 \Website\sitecore\shell\Applications\Dialogs\ExternalLink\ExternalLink.xml

You have in file :

    <Combobox ID="Target" GridPanel.Width="100%" Width="100%" Change="OnListboxChanged">
      <ListItem Value="Self" Header="Active browser"/>
      <ListItem Value="New" Header="New browser"/>
      <ListItem Value="Custom" Header="Custom"/>
    </Combobox>

You can delete first and last ListItem from Combobox.

  Please copy first time ExternalLink.xml to : \web\sitecore\shell\Override\ folder and after modify file .

Upvotes: 2

Related Questions