Search Results links opening in new window?

Permalink
Would anyone know if this is a default behavior and how to tun it off? The weird part is that the the code doe does not display a "_blank" attribute so I am not sure what is going on!

shondy
 
12345j replied on at Permalink Reply
12345j
in tinymce there should be an option when adding a link with the little chain link icon.
shondy replied on at Permalink Reply
shondy
These are search results that populate the page through a search query. There does not appear to be a function within the search block that allows you to control how the links are directed.
jordanlev replied on at Permalink Reply
jordanlev
Do you mean the built-in concrete5 Search block? I've never seen them open links in a new window, and if you don't see the target="_blank" thing when you view source on the page, then something really weird is going on. Try it in a different web browser. Also think about any custom javascript you may have applied to your theme or any addons that might do something weird to links like this.
Also try it from another computer if possible.

If none of that works, you should post a link to the page here in the forums so people can take a closer look.
shondy replied on at Permalink Reply
shondy
http://034e687.netsolhost.com/

I tried it in IE9, Firefox, Chrome, Safari, all with the same result. Type in "about" in the search from the home page and you will see that all the results links are opening in a new window. There is no additional javascript being loaded so I would say that's probably not the issue.
jordanlev replied on at Permalink Reply
jordanlev
Looks like there is some javascript causing this -- in the header of your theme:
<script type = 'text/javascript'> 
function openinnew() {
   if (!document.getElementsByTagName) return;
   var links = document.getElementsByTagName("a");
   for (var i=0; i<links.length; i++) {
      if (links[i].getAttribute("href")) {
         if (links[i].getAttribute("rel") == "external" || (links[i].getAttribute("href").substring(0,4) == 'http' && links[i].getAttribute("href").indexOf('location.hostname') == -1)) {
            links[i].onclick = new Function("window.open('"+links[i].getAttribute("href")+"'); return false;");
         }
      }
   }
}
window.onload = openinnew;
</script>
shondy replied on at Permalink Reply
shondy
Ahh...I think I know what this is. I hard-coded this into the page because I was trying to get external links to open in a new window as well as files such as PDFs. I was successful with the PDFs but not the external links. So this is obviously affecting other generated links. Maybe the link functionality is improved in 5.5? Currently when you create a link and check to open in a new window it doesn't work.

Thanks for finding this for me!

Chris