Archive for myfreeforum.org Before posting please check the "stickies" in the support forums.
Please ask questions in real English and not "txt". You will get a better response.
Please do not ask support questions via PMs.
 



       myfreeforum.org Forum Index -> PhpBB3 General Support
Vicky

Links

http://drewschofield.myfreeforum.org

Members are reporting that when they post links to sites outside the forum they are not opening in a new window but taking you away from the forum.

Simple question really, is there anyway I can make the links open in a new window?
admin (no pm's please)

this is a common gripe about the way phpbb3 works. I am planning to fix it.
Vicky

OK, I'll get members to add a line about right clicking the link so they can open in a new window for now
Zudane

I've put in a script from a phpmod site, simple script that goes into the header, problem is that you need to use a function to call it - which fails to work if you need other things called... but here's one way to work it:

Add this to your overall_header template, between the head tags:

Code:
<script language="Javascript" type="text/javascript">
// <![CDATA[
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
// Open external links in new window in a XHTML 1.x compliant way.
function exlink() {
   var current_domain = document.domain;
   if (!current_domain || !document.getElementsByTagName) return;
   var hrefels = new Array;
   var hrefelslen = 0;
   var hrefinner = '';
   hrefels = document.getElementsByTagName("a");
   hrefelslen = hrefels.length;
   for (var i = 0; i < hrefelslen; i++) {
      hrefinner = hrefels[i].innerHTML.toLowerCase();
      if ( (hrefels[i].href == '') || (hrefels[i].href.indexOf('javascript') >=0 ) || (hrefinner.indexOf('<a') >= 0) || (hrefels[i].href.indexOf(current_domain) >= 0) ) {
         continue;
      }
      hrefels[i].onclick = function () { window.open(this.href); return false; };
   }
}
// www.phpBB-SEO.com SEO TOOLKIT END
// ]]>
</script>


Then in your Body tag <body ...  Add this:
onload="exlink();"

If you need to add anything else to happen when the page loads, just add to the onload (if you don't understand that, you shouldn't be adding anything to it)

       myfreeforum.org Forum Index -> PhpBB3 General Support
Page 1 of 1
Create your own free forum | Buy a domain to use with your forum