/    Sign up×
Community /Pin to ProfileBookmark

Automatic Browser Detection

All of the sudden – the following code started appearing on all of the pages on my site:

<script type=”text/javascript” language=”JavaScript”>
//browser detection
function Is()
{
var agent = navigator.userAgent.toLowerCase();
this.major = parseInt(navigator.appVersion);
this.minor = parseFloat(navigator.appVersion);

this.ns = ((agent.indexOf(‘mozilla’) != -1) &&
(agent.indexOf(‘spoofer’) == -1) &&
(agent.indexOf(‘compatible’) == -1) &&
(agent.indexOf(‘opera’) == -1) &&
(agent.indexOf(‘webtv’) == -1));

this.ns2 = (this.ns && (this.major == 2));
this.ns3 = (this.ns && (this.major == 3));
this.ns4 = (this.ns && (this.major == 4));
this.ns6 = (this.ns && (this.major >= 5));
this.ie = (agent.indexOf(“msie”) != -1);
this.ie3 = (this.ie && (this.major < 4));
this.ie4 = (this.ie && (this.major == 4));
if(this.ie4 && (agent.indexOf(“msie 5.0”) != -1))
{
this.ie4=false;
this.ie5=true;
}

this.ieX = (this.ie && !this.ie3 && !this.ie4);
}

var is = new Is();

//Write text on top of a layer
function WriteLayer(id,text)
{
var DOM = (document.getElementById) ? true:false;
var divID;

if (is.ns4) divID = document.layers[id];
else if (is.ie4) divID = document.all[id];
else if (DOM) divID = document.getElementById(id);

if (is.ns4)
{
divID.document.open();
divID.document.write(text);
divID.document.close();
}
else if (DOM ||is.ie4)
{
divID.innerHTML = text;
}
}

function SetLayerVisibility(id,visibility)
{
if (is.ieX||is.ns6)
{
this.obj = document.getElementById(id).style;
this.obj.visibility = visibility;
}
else if(is.ie4)
{
this.obj = document.all[id].style;
this.obj.visibility = visibility;
}
else if(is.ns4)
{
this.obj = document.layers[id];
return this.obj;
}
}

function SubmitData(code)
{
var flag;

flag = eval(‘isReady_’ + code + ‘()’);

if (!flag)
{
return false;
}

eval(‘document._‘ + code + ‘.target=”_self”;’);
eval(‘document._’ + code + ‘.submit();’);
}

var Reqd;
var eMai;

function trim(s)
{
while (s.substring(0,1) == ‘ ‘)
{
s = s.substring(1,s.length);
}
while (s.substring(s.length-1,s.length) == ‘ ‘)
{
s = s.substring(0,s.length-1);
}
return s;
}

function CheckEmail(eMai)
{
eMai=trim(eMai);
var ok = “1234567890abcdefghijklmnopqrstuvwxyz[].@_ABCDEFGHIJKLMNOPQRSTUVWXYZ”;
for(h=0; h < eMai.length ;h++)
{
if(ok.indexOf(eMai.charAt(h))<0)
{
return (false);
}
}
var re = /(@.*@)|(..)|(^.)|(^@)|(@$)|(.$)|(@.)/;
var re_two = /^.+@([?)[a-zA-Z0-9.]+.([a-zA-Z]{2,4}|[0-9]{1,4})(]?)$/;
if (!eMai.match(re) && eMai.match(re_two))
{
return -1;
}
}
function isReady_4575232506016872()
{
var bFieldsFilled=true;
if(document._
4575232506016872.submission_challenge && !document._4575232506016872.submission_challenge.value.length)
{
document._
4575232506016872.submission_challenge.style.background = “#ff0000”;
if( bFieldsFilled)
{
document._4575232506016872.submission_challenge.focus();
bFieldsFilled=false;
}
}

if(!bFieldsFilled)
{
var str='<br><b><FONT size=”3″ face=”Verdana, Arial, Helvetica, sans-serif” color=”red”>’;
str +=’This Form cannot be submitted until the missing<BR>’;
str +=’fields (labelled below in red) have been filled in.</FONT></b>’;
WriteLayer(“MissingFields_4575232506016872”,str);

SetLayerVisibility(“MissingFields_4575232506016872″,”visible”);

}
else
{
SetLayerVisibility(“MissingFields_4575232506016872″,”hidden”);
}

return bFieldsFilled;
}

</script>

Any idea of why this is happening? And now that it appears above the <body> tag on every page… will this hurt my rankings?

Thank you,

Jeff

to post a comment
HTML

3 Comments(s)

Copy linkTweet thisAlerts:
@donatelloFeb 16.2009 — If you are using a free host they are probably inserting some kind of code to each file that you upload.

I always stick JavaScript and file information in external files so that Google can scan further down your page without tripping over all that JavaScript and CSS.

I can't say it will hurt your SEO, but it definitely won't help.
Copy linkTweet thisAlerts:
@IckybluetoesauthorFeb 16.2009 — Hi donatello,

Appreciate your help. I'm having the hosting company look into it. It's not a free service - and much like yourself, I like to tuck my Javascript away as well.

Jeff
Copy linkTweet thisAlerts:
@donatelloFeb 19.2009 — Could you be picking it up from a test server?

I had that happen once. I used to use a test server in Poland, so it was easy to see that all this Polish language crap got stuffed into my page....

?

Let us know when you get it sorted out. Might come in handy to know some day. I seem to hit every single issue there is at some point or another. ? ?
×

Success!

Help @Ickybluetoes spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...