What does this Javascript code mean?

I'm not a programmer but I need to decipher what this piece of javascript does.

<script language="javascript">
var refer_url   = window.top.location;
if (/\?google5/i.test(refer_url))  {
  //document.location.href = "http://"+sid+".evony.com/s.html?loginid=747970653D74727947616D65&adv=google5";
    //document.location.href  = "http://www.evony.com/index.do?PageModule=RegFromFacebookCanvas&T=12&adv=google5";
Who is Participating?
If you're not a programmer, the explanation may not make much sense, but I'll be happy to try for you.

In reality, the code does nothing, because if performs an "if" test with both actions commented out by "//" characters." That means that regardless of the test result, the actions that the code would take are, in effect, vacuous.

It appears to me that this code is trying to set up some automatic login process to a site in the "evony.com" domain if the user reached the current page from a google site; otherwise, it would route to a generic registration page at "http://www.evony.com"

Again, the code as written will do nothing, because each of the alternatives following the "if" statement are prefixed with double-slash characters that serve as a "comment" symbol in Javascript, causing the Javascript interpreter to ignore the rest of the line, executing nothing.

Hope that makes some degree of sense. In a nutshell, were the lines not commented out, it appears the code is trying to determine if the user arrived on a page from a Google site, and redirect to a particular location accordingly.

check the

Open in new window

of the main page, if the

Open in new window

contains ?google5 redirect the current page to http://some_SID_here.evony.com/s.html?loginid=747970653D74727947616D65&adv=google5
Did you update your original post? I did not see the first line commented...
futr_visionAuthor Commented:
Thanks. I suspected it didn't do anything but wanted to make sure.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.