Re-direct Open New Window

Hi Guys,

I need to redirect to my affiliate site using my own domain link. Now I send my visitors to my .html page which has the Redirect meta tag in it! The problem is that it doesn’t accept target=“_blank” within my link code.

Any solutions here?

Thanks!

Hi,
Not sure I fully get the question but …


function externalLinks() { 
  if (!document.getElementsByTagName) return; 
    var anchors = document.getElementsByTagName("a"); 
    for (var i=0; i<anchors.length; i++) { 
      var anchor = anchors[i]; 
      if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
        anchor.target = "_blank"; 
      } 
    }
} 
window.onload = externalLinks;


I add this code to my <body> tags and keep the meta redirect as well?
Do I need to place URL inside the script somewhere?

My code:

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<html>
<head>
<meta http-equiv=“REFRESH” content=“0;url=http://www.test.com/click?zone=0000&ad=000”>
<script type=“text/javascript”>

var _gaq = _gaq || ;
_gaq.push([‘_setAccount’, ‘UA-00000000-0’]);
_gaq.push([‘_trackPageview’]);

(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
</head>
</html>

This code will redirect, but doesn’t open in a new window!

I want page to open in a new window. How can I do this?

Many thanks!

The scenario is that a hyperlink on a page is clicked. This replaces the current page with the redirect page which opens the page to redirect to in a new window. Currently the user is then left with the redirect page.

To avoid this you must go back one in the history using

window.history(-1)

at the end of the onload function.

https://developer.mozilla.org/en/window.open