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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.