0

I have a link of that kind :

<a href="javascript:goNextPage('JERfyuZEnhEjfdGfgre543gREZf65vRvf35HGdv89g')">test</a>

On any browser if I want to open this link on a new tab I will get a blank page, which is normal because it's javascript code, note really a link...

But I want the user to be able to open in a new tab, without decrypting the link (SEO matters), is there any way ? Any constructive comment would be apreciated.

Thx

Sunny Patel
  • 7,830
  • 2
  • 31
  • 46

1 Answers1

0

I think you can not directly decript and open in a new tab, but you could change the order of the two steps in order to open the link in a new tab:

First make a link like this one:

<a href="?id=JERfyuZEnhEjfdGfgre543gREZf65vRvf35HGdv89g" rel="nofollow" target="_blank">Test</a>

This will open the current page in a new tab, but with an additional parameter in the url. Now, when the page is loaded in the new tab, you could precheck if ID is set with php or, if it should be a pure js solution, check the parameter like this:

var $_GET = {};
document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () {
  function decode(s) { return decodeURIComponent(s.split("+").join(" "));  }
  $_GET[decode(arguments[1])] = decode(arguments[2]);
});
custom_url_decrypt_function($_GET["id"]); //Your Own Function which redirects

(You can learn more about getting URL params here)

In this code example you should only replace custom_url_decrypt_function with the name of your decrypt function.

Hope it helped :)

Community
  • 1
  • 1
GlabbichRulz
  • 948
  • 9
  • 28