Advanced search  

News:

cpg1.5.46 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter recently discovered vulnerabilities. It is important that all users who run version cpg1.5.44 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: External Links open in new window  (Read 308 times)

0 Members and 1 Guest are viewing this topic.

donsenilo

  • Coppermine regular visitor
  • **
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 92
    • Bookmarks (Links), Grafik, Musik, Movies (Filme), DVD's, CD's, Amazon-Shop by Starmaker - Mark Tailor
External Links open in new window
« on: August 22, 2017, 02:47:09 am »

Hi

I included this code right before the "</head>" in "template.html" (in my case "cpg15x\themes\curve\template.html"):
Code: [Select]
<script>
$(function() {
   $("a[href^='http']:not([href*='YOURDOMAIN.XXX'])").each(function() {
       $(this).click(function(event) {
             event.preventDefault();
             event.stopPropagation();
             window.open(this.href, '_blank');
        }).addClass('externalLink');
   });
});
</script>
Replace "YOURDOMAIN.XXX" with your domain !!!

What it does: it opens all links they are not containing your domain in a new window.

Maybe this is useful for you.
Logged

ron4mac

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 666
Re: External Links open in new window
« Reply #1 on: August 22, 2017, 12:56:55 pm »

You are running CPG 1.6.x. If, in the future, you perform an automatic update to CPG, the curve theme will be overwritten, removing your changes. You should copy or rename the curve theme folder before making changes to its files. Then make that theme your default in the config.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15369
Re: External Links open in new window
« Reply #2 on: August 23, 2017, 12:26:54 pm »

Isn't this exactly what the link_target plugin does?
Logged
Pages: [1]   Go Up
 

Page created in 0.034 seconds with 20 queries.