473,805 Members | 1,939 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

need help understanding this code.

Hi,

I've been trying to figure out this javascript code used here (this code is
used for supplying browser info to a tracking company):

In particular I'm trying to understand this line:
EXd=document;EX w?"":EXw="na";E Xb?"":EXb="na" ;
and this one: EXd.write("<img
src=\"http://t0.extreme-dm.com","/0.gif?tag=abc&j =y&srw="+EXw+"& srb="+EXb+"&
","l="+escape(E Xd.referrer)+"\ " height=1 width=1>");//-->

Why do they have a variable j=y defined? There is no 'j' variable defined
in the code.

If I modify the http://t0.extreme-dm.com and send the results to my ASP page
and use Querystrings to see what the values are, I only get the Screen width
and colour depth values. The referrer information is not showing. I also
don't understand how they can extract users country domain from this code.

Thanks
Tristan
www.backpackpro.com
----------- Complete code below ---------------
<a target="_top" href="http://t.extreme-dm.com/?login=abc"> <img
src="http://u1.extreme-dm.com/i.gif" height=2
border=0 width=2 alt=""></a>
<script language="javas cript1.2"><!--
EXs=screen;EXw= EXs.width;navig ator.appName!=" Netscape"?
EXb=EXs.colorDe pth:EXb=EXs.pix elDepth;//-->
</script>
<script language="javas cript"><!--
EXd=document;EX w?"":EXw="na";E Xb?"":EXb="na" ;
EXd.write("<img src=\"http://t0.extreme-dm.com",
"/0.gif?tag=abc&j =y&srw="+EXw+"& srb="+EXb+"&",
"l="+escape(EXd .referrer)+"\" height=1 width=1>");//-->
</script>
</p>
<noscript><im g height=1 width=1 alt=""
src="http://t0.extreme-dm.com/0.gif?tag=abc&j =n"></noscript>
Jul 20 '05 #1
9 1610
That's some dense shit, dude. But seriously I don't think you quoted all
the relevent code to make heads or tails of this, looks like you only
quoted the last line or two.

These two statements:

EXw?"":EXw="na" ;
EXb?"":EXb="na" ;

All they do is, if EXw and EXb are null, then set them to "na" (as in
Not Available?). But it must be somewhere earlier in the code where they
are setting EXw and EXb to initial values in the first place.

In regards to the "j=y" statement; the way you've quoted the code, the
variable j (and value y) are used entirely on the server. There is no
client-side javascript here with a variable j and value of y. You need
to look on the server side script (if you have it) to find out what the
"j=y" is all about.

Did you inherit this code from another developer, or are you trying to
*ahem* learn from some other site's techniques?

--

Bryan Field-Elliot
http://netmeme.org

Elmbrook wrote:
Hi,

I've been trying to figure out this javascript code used here (this code is
used for supplying browser info to a tracking company):

In particular I'm trying to understand this line:
EXd=document;EX w?"":EXw="na";E Xb?"":EXb="na" ;
and this one: EXd.write("<img
src=\"http://t0.extreme-dm.com","/0.gif?tag=abc&j =y&srw="+EXw+"& srb="+EXb+"&
","l="+escape(E Xd.referrer)+"\ " height=1 width=1>");//-->

Why do they have a variable j=y defined? There is no 'j' variable defined
in the code.

If I modify the http://t0.extreme-dm.com and send the results to my ASP page
and use Querystrings to see what the values are, I only get the Screen width
and colour depth values. The referrer information is not showing. I also
don't understand how they can extract users country domain from this code.

Thanks
Tristan
www.backpackpro.com
----------- Complete code below ---------------
<a target="_top" href="http://t.extreme-dm.com/?login=abc"> <img
src="http://u1.extreme-dm.com/i.gif" height=2
border=0 width=2 alt=""></a>
<script language="javas cript1.2"><!--
EXs=screen;EXw= EXs.width;navig ator.appName!=" Netscape"?
EXb=EXs.colorDe pth:EXb=EXs.pix elDepth;//-->
</script>
<script language="javas cript"><!--
EXd=document;EX w?"":EXw="na";E Xb?"":EXb="na" ;
EXd.write("<img src=\"http://t0.extreme-dm.com",
"/0.gif?tag=abc&j =y&srw="+EXw+"& srb="+EXb+"&",
"l="+escape(EXd .referrer)+"\" height=1 width=1>");//-->
</script>
</p>
<noscript><im g height=1 width=1 alt=""
src="http://t0.extreme-dm.com/0.gif?tag=abc&j =n"></noscript>


Jul 20 '05 #2
In article <C3************ *******@news02. tsnz.net>,
el******@paradi se.nospam.net.n z says...
Hi,

I've been trying to figure out this javascript code used here (this code is
used for supplying browser info to a tracking company):

In particular I'm trying to understand this line:
EXd=document;
Set EXd to the "document" object;
EXw?"":EXw="na" ;
If EXw is empty, set it to "na".
EXb?"":EXb="na" ;
If EXb is empty, set it to "na".
and this one: EXd.write("<img
src=\"http://t0.extreme-dm.com","/0.gif?tag=abc&j =y&srw="+EXw+"& srb="+EXb+"&
","l="+escape(E Xd.referrer)+"\ " height=1 width=1>");//-->
That writes out an image using the values the script has just assigned.

Why do they have a variable j=y defined? There is no 'j' variable defined
in the code.
The "j" isn't used in the code you've given here - it may be used in the
server-side script that servers up the image, though. It's part of the
URL, not part of the JavaScript. I imagine that other users may have
"j" set to something else, otherwise there'd be no point having it.

If I modify the http://t0.extreme-dm.com and send the results to my ASP page
and use Querystrings to see what the values are, I only get the Screen width
and colour depth values.
Perhaps your ASP that's trying to get the values is broken.

The referrer information is not showing. I also
don't understand how they can extract users country domain from this code.


The won't extract the user's country domain from that code. They'll
have their server-side code do it by tracking the remote IP address (ie.
the site visitor's address) from which the request is made. It's rather
inaccurate, though.

--
Hywel I do not eat quiche
http://hyweljenkins.co.uk/
http://hyweljenkins.co.uk/mfaq.php
Jul 20 '05 #3
Ivo
"Elmbrook" <el******@parad ise.nospam.net. nz> wrote in message
news:C3******** ***********@new s02.tsnz.net...
In particular I'm trying to understand this line:
EXd=document;EX w?"":EXw="na";E Xb?"":EXb="na" ;
EXw?"":EXw="na"
is short for: if EXw has not been assigned a value in the preceding
javascript1.2 block, give it a value of "na".
and this one: EXd.write("<img
src=\"http://t0.extreme-dm.com","/0.gif?tag=abc&j =y&srw="+EXw+"& srb="+EXb+"& ","l="+escape(E Xd.referrer)+"\ " height=1 width=1>");//-->

Why do they have a variable j=y defined? There is no 'j' variable defined
in the code.

So what? Do you see tag, srw, srb anywhere else? This is where j gets
defined. Think of y as a string of length 1. It probably means "javascript
enabled=yes". Look in the noscript tag where you 'll find "j=n".
Jul 20 '05 #4
In article <C3************ *******@news02. tsnz.net>, Elmbrook wrote:
Hi,

I've been trying to figure out this javascript code used here (this code is
used for supplying browser info to a tracking company):

In particular I'm trying to understand this line:
EXd=document;EX w?"":EXw="na";E Xb?"":EXb="na" ;
This uses

A?B:C

If A is true, then do B, otherwise do C.

If A is not a boolean test, but some variable,
then A? just checks if A is defined.

So, A?B:C does B if A is defined, otherwise it does C.

EXw?"":EXw="na"

Well, the author REALLY WANTS EXw to be defined and if
it is not defined he wants to define it a the string
"na" (not available or not applicabe)..

EXw ? "" : EXw="na"

IS EXw defined? If, nothing Otherwise define it
leave it alone as "na"
and this one: EXd.write("<img
src=\"http://t0.extreme-dm.com","/0.gif?tag=abc&j =y&srw="+EXw+"& srb="+EXb+"&
","l="+escape(E Xd.referrer)+"\ " height=1 width=1>");//-->
That creates a URL:

"0.gif?tag=abc& j=y&srw..."
Why do they have a variable j=y defined? There is no 'j' variable defined
in the code.


The "j" is inside the string. It is not a JavaScript variable, but just
text. IF that works (the document.write, sicne EXd is the document,
then it must have been written by JavaScript. I would guess the tag
will be interpreted as the author (when he checks his web logs and
sees this) as JavaScript IS enabled (j=y) (or else this won't even
be written to the documnet).
Jul 20 '05 #5
I'm trying to figure out how I can record the statistics of the visitors to
my website, where they came from etc and send this to an ASP page.

Are there Javascripts available for recording, referreal, domain etc?

Thanks for your help
"Bryan Field-Elliot" <br***@netmeme. org> wrote in message
news:IhIdb.4551 17$Oz4.260098@r wcrnsc54...
That's some dense shit, dude. But seriously I don't think you quoted all
the relevent code to make heads or tails of this, looks like you only
quoted the last line or two.

These two statements:

EXw?"":EXw="na" ;
EXb?"":EXb="na" ;

All they do is, if EXw and EXb are null, then set them to "na" (as in
Not Available?). But it must be somewhere earlier in the code where they
are setting EXw and EXb to initial values in the first place.

In regards to the "j=y" statement; the way you've quoted the code, the
variable j (and value y) are used entirely on the server. There is no
client-side javascript here with a variable j and value of y. You need
to look on the server side script (if you have it) to find out what the
"j=y" is all about.

Did you inherit this code from another developer, or are you trying to
*ahem* learn from some other site's techniques?

--

Bryan Field-Elliot
http://netmeme.org

Elmbrook wrote:
Hi,

I've been trying to figure out this javascript code used here (this code is used for supplying browser info to a tracking company):

In particular I'm trying to understand this line:
EXd=document;EX w?"":EXw="na";E Xb?"":EXb="na" ;
and this one: EXd.write("<img
src=\"http://t0.extreme-dm.com","/0.gif?tag=abc&j =y&srw="+EXw+"& srb="+EXb+"& ","l="+escape(E Xd.referrer)+"\ " height=1 width=1>");//-->

Why do they have a variable j=y defined? There is no 'j' variable defined in the code.

If I modify the http://t0.extreme-dm.com and send the results to my ASP page and use Querystrings to see what the values are, I only get the Screen width and colour depth values. The referrer information is not showing. I also don't understand how they can extract users country domain from this code.
Thanks
Tristan
www.backpackpro.com
----------- Complete code below ---------------
<a target="_top" href="http://t.extreme-dm.com/?login=abc"> <img
src="http://u1.extreme-dm.com/i.gif" height=2
border=0 width=2 alt=""></a>
<script language="javas cript1.2"><!--
EXs=screen;EXw= EXs.width;navig ator.appName!=" Netscape"?
EXb=EXs.colorDe pth:EXb=EXs.pix elDepth;//-->
</script>
<script language="javas cript"><!--
EXd=document;EX w?"":EXw="na";E Xb?"":EXb="na" ;
EXd.write("<img src=\"http://t0.extreme-dm.com",
"/0.gif?tag=abc&j =y&srw="+EXw+"& srb="+EXb+"&",
"l="+escape(EXd .referrer)+"\" height=1 width=1>");//-->
</script>
</p>
<noscript><im g height=1 width=1 alt=""
src="http://t0.extreme-dm.com/0.gif?tag=abc&j =n"></noscript>

Jul 20 '05 #6
Spamless <Sp******@Nil.n il> writes:
This uses

A?B:C

If A is true, then do B, otherwise do C. If A is not a boolean test, but some variable,
then A? just checks if A is defined.
That is not strictly correct.

If A is an undeclared variable, then "A?B:C" fails with an "undeclared
variable". If A is a declared variable, then its value is converted to
a boolean (as by the Boolean function). The values that are converted
to false are: 0, NaN, undefined, null, "" (empty string), and false
itself.

So, if A is defined but has the value 0, the "else" branch is still
used.
EXw?"":EXw="na"


personally, I would have written:

EXw = EXw || "na";

It has the same effect, is easier to read (IMHO), and is even shorter.

What he really means is
if(!EXw)EXw="na ";
but that is one charater longer.

Where "if" is a statement that selects one of two *statements* based
on a conditional expression, the ?:-operator is an expression that
selects one of two expressions based on a condition. The original
author uses it as a statement, which *I* think is bad style.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #7
All this stuff should be done server-side (e.g. ASP, JSP, Perl,
whatever), rather than client-side (e.g. Javascript). From the server,
you should have access to the referring URL and the IP address of the
client (and from there, you can find their domoain). All this and more
in the HTTP headers. No client-side Javascript required (or even useful).

Better yet, your web server is probably already keeping this information
in it's logs. Apache and IIS both support standard "Common" format for
web hit logs, which includes client IP address and referring URL.

Good luck,

--

Bryan Field-Elliot
http://netmeme.org

Elmbrook wrote:
I'm trying to figure out how I can record the statistics of the visitors to
my website, where they came from etc and send this to an ASP page.

Are there Javascripts available for recording, referreal, domain etc?

Thanks for your help


Jul 20 '05 #8
Thanks, but the problem is that some of my webpages are static and are being
served by my local ISP. So when I found that this company had a way of
sending stats to their server from my static page, I was interested in how
they did it.

"Elmbrook" <el******@parad ise.nospam.net. nz> wrote in message
news:0b******** ***********@new s02.tsnz.net...
I'm trying to figure out how I can record the statistics of the visitors to my website, where they came from etc and send this to an ASP page.

Are there Javascripts available for recording, referreal, domain etc?

Thanks for your help
"Bryan Field-Elliot" <br***@netmeme. org> wrote in message
news:IhIdb.4551 17$Oz4.260098@r wcrnsc54...
That's some dense shit, dude. But seriously I don't think you quoted all
the relevent code to make heads or tails of this, looks like you only
quoted the last line or two.

These two statements:

EXw?"":EXw="na" ;
EXb?"":EXb="na" ;

All they do is, if EXw and EXb are null, then set them to "na" (as in
Not Available?). But it must be somewhere earlier in the code where they
are setting EXw and EXb to initial values in the first place.

In regards to the "j=y" statement; the way you've quoted the code, the
variable j (and value y) are used entirely on the server. There is no
client-side javascript here with a variable j and value of y. You need
to look on the server side script (if you have it) to find out what the
"j=y" is all about.

Did you inherit this code from another developer, or are you trying to
*ahem* learn from some other site's techniques?

--

Bryan Field-Elliot
http://netmeme.org

Elmbrook wrote:
Hi,

I've been trying to figure out this javascript code used here (this code
is
used for supplying browser info to a tracking company):

In particular I'm trying to understand this line:
EXd=document;EX w?"":EXw="na";E Xb?"":EXb="na" ;
and this one: EXd.write("<img
src=\"http://t0.extreme-dm.com","/0.gif?tag=abc&j =y&srw="+EXw+"& srb="+EXb+"& ","l="+escape(E Xd.referrer)+"\ " height=1 width=1>");//-->

Why do they have a variable j=y defined? There is no 'j' variable

defined in the code.

If I modify the http://t0.extreme-dm.com and send the results to my
ASP page and use Querystrings to see what the values are, I only get the Screen width and colour depth values. The referrer information is not showing. I also don't understand how they can extract users country domain from this code.
Thanks
Tristan
www.backpackpro.com
----------- Complete code below ---------------
<a target="_top" href="http://t.extreme-dm.com/?login=abc"> <img
src="http://u1.extreme-dm.com/i.gif" height=2
border=0 width=2 alt=""></a>
<script language="javas cript1.2"><!--
EXs=screen;EXw= EXs.width;navig ator.appName!=" Netscape"?
EXb=EXs.colorDe pth:EXb=EXs.pix elDepth;//-->
</script>
<script language="javas cript"><!--
EXd=document;EX w?"":EXw="na";E Xb?"":EXb="na" ;
EXd.write("<img src=\"http://t0.extreme-dm.com",
"/0.gif?tag=abc&j =y&srw="+EXw+"& srb="+EXb+"&",
"l="+escape(EXd .referrer)+"\" height=1 width=1>");//-->
</script>
</p>
<noscript><im g height=1 width=1 alt=""
src="http://t0.extreme-dm.com/0.gif?tag=abc&j =n"></noscript>


Jul 20 '05 #9
In article <he**********@h otpop.com>, Lasse Reichstein Nielsen wrote:
Spamless <Sp******@Nil.n il> writes:
This uses

A?B:C

If A is true, then do B, otherwise do C.
If A is not a boolean test, but some variable,
then A? just checks if A is defined.


That is not strictly correct.

If A is an undeclared variable, then "A?B:C" fails with an "undeclared
variable". If A is a declared variable, then its value is converted to
a boolean (as by the Boolean function). The values that are converted
to false are: 0, NaN, undefined, null, "" (empty string), and false
itself.


Yes. I should have been clearer.

var A;

declares A (but it hasn't been defined to be anything)
and A?"":A="na"
will define it.

Without declaring it, you should just get an error.

(I hope the author of the page delcared A somewhere ...)
So, if A is defined but has the value 0, the "else" branch is still
used.


Yes, that's true too.
Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1846
by: Mike | last post by:
Hey guys, need some help understanding some things that maybe someone can explain or clarify it a little better then a text book. Here is my understanding so far: Class - basically a shell for your code Fields - basically just a variable but can be "write protected" Properties - access fields, they can retrieve data contained in the "variable"
19
4117
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can easily understand a newbie using bound controls or someone with a tight deadline. I guess I need...
26
2210
by: Bail | last post by:
I will have a exam on the oncoming friday, my professor told us that it will base upon this program. i am having troubles understanding this program, for example what if i want to add all the total calories that the user input together. determine which food has the largest calories. how do i start to modifiy the program inorder to do the things i listed above. thanks #include <stdio.h> #include <stdlib.h>
8
3033
by: BJ | last post by:
Problem: How can I code up a client side process to detect if the network is available? Synopsis: I am writing ASP.NET input forms for a Panasonic Tuff book. The users will be walking around the plant with a wireless connection. There are some pockets of non-connectivity. I've been tasked with disabling the submit button on the form if the network is unavailable. Possible solution: I can instantiate a timed process (VB.NET 2.0
2
1977
by: Martin | last post by:
Hello, We are in the process of putting together an A class PHP Development team(ecommerce / billing applications) for a project in the Bay Area. Reqt. details: ReqId : Req-3616 - Senior PHP Developer Primary Skills: PHP, Linux, Apache Secondary Skills: C++, SQL
22
2338
by: the_grove_man | last post by:
I purchased a book titled "Pro ASP.NET 2.0" to get up to speed on web stuff because I ususally do Windows Form Applications.. But in the first chapters I was reading this week it brought to mind some things I heard in the past that I thought someone could clarify. On Page 6 it states "ASP.NET web pages (and web services) are executed within the CLR (common language runtime), so they can be authored in any language that has a...
9
2199
by: MrHelpMe | last post by:
Hello again experts, I have successfully pulled data from an LDAP server and now what I want to do is drop the data into a database table. The following is my code that will insert the data but that has problems. FullName=Request.Form("Name") Email=Request.Form("Email") GivenName=Request.Form("GivenName")
8
1825
by: boki_pfc | last post by:
Hi Everybody, I am looking for an advice on following: I have that "pleasure" of reading C++ codes that have been written by person(s) that have not attended the same C++ classes that I did or have not read the same C++ books that I have read. This kind of people has written some parts of the code that use notations that I am not familiar with (and that probably also includes also 50 % of other C ++ programmers). While everybody who...
6
1412
by: Steven W. Orr | last post by:
Given the following code: (I hope it's as simple as possible) :-) #! /usr/bin/python import new class BASE: def __init__( self ): print 'Hello from BASE init' def m1( self ): print 'M1 Base: Self = ', self def m1replace( self ):
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10609
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10360
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10105
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7646
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4323
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3845
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.