Forum Moderators: open
I've used a JavaScript cookie set/ASP cookie read method for years (if ASP can read the cookie, log it into the db). I just started thinking about this code again, wondering if there's a way I haven't thought about that's better. I researched some other methods, and have decided to get some opinions here.
How do YOU do it?
Edit: that is one sweet object. I just ran the demo and it gave me back Height, Available Height, Width and Available Width + a crapload of other neato stuff.
Here is little snipit of javascript that I use to detect the users screen resolution.
if(typeof(screen)=="object")
{
sr = screen.width+"x"+screen.height;
ar = screen.availWidth + "x" +screen.availHeight;
cd = screen.colorDepth;
}
Screen size
Browser size
Screen color depth
Java enabled
Macromedia Director plugin
Macromedia Shockwave (flash) plugin
Realplayer plugin
QuickTime plugin
Mediaplayer plugin
Acrobat PDF plugin
Just download the .zip file from here...
extract the following file...
/wwwroot/js/awstats_misc_tracker.js
Include it in all your pages and the data will be stored in a cookie which can be accessed via ASP.
I know on my sites that I maintain usually the if the javascript is disabled the cookies and referer urls are all block also, and I either take it as an anonymiser/proxie at work removing them, or some other blocking method in place.
And for making your own version, its pretty easy there a previous post list awstats javascript tracker code. I made my own to track the items I wanted.
Examples of which are.
1. Screen resolution/actual window size
2. referer (to get a second copy incase the first is blocked)
3. UserLang
4. Javascript Version
Then its just a mater of linking this information to a session via cookie or custom url (depending) on your options.
Yeah that's why I threw BrowserHawk out there. Even thought it's 3rd party in my mind it's better then the js solution because it doesn't rely on js.
I assume that's some kind of April Fool's day joke?
Browserhawk does rely on Javascript to get the screen resolution too.
Pretty much the only way of getting the screen resolution is through javascript. If the visitor doesn't have javascript enabled, you're not going to get the screen size.
mrMister, I think I see how it works now...
They're trying to make a profit, so they focus all their marketing towards giving the impression that their product does something that others don't, when in fact it's been done before (usually better) by the open source community.
That's the biggest gripe I have about commercial components, you can't trust them to be honest and open about how their product works and what it does.