473,739 Members | 7,912 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

verifying client has javascript enabled - server side solution

http://www.icarusindie.com/wiki/inde...vascript_Check

Sample source included

This method requires that your pages are PHP enabled and you have mySQL.
Although I suppose you could also use PHP sessions (not cookies as they're
client editable). You could actually use any server side scripting language
such as Perl or ASP and any database like MS SQL Server. I prefer PHP and
MySQL.

The short version is you have a default image displayed and then use
javascript to replace the default image with a script reference. The
browser will then load that script which counts the javascript hit. The hit
to the page is always counted. You then simply check that the javascript
hit count and the page hit counts are the same.

You will need to give the user a "free" visit or do an automatic redirect on
the first hit. If the JS count and the page hit counts don't match, JS is
disabled and you can display an error message to the user instead of the
content.

This can also be used for verifying that visitors are seeing your ads. You
simply devise a script that is called which displays the ad which also
counts the ad view. Ad views and hit counts then must match or the user is
blocked from seeing the content.

If javascript views are greater than page hits, then that's okay too since
it just means the main page is cached but the image is not.

If you can think of any circumstances under which this technique for
detecting javascript being enabled would fail, let me know.

And no, this is not being used on my own site...yet. Ad revenue from Google
AdSense is currently covering costs nicely so there's no reason to go after
people who block ads which results in cost to me with no chance of a return.

As a visitor, I have the right to object to your ads. As a site owner I
have a right to refuse service if you don't allow the ads to even display.
It's fair. I recognize that sites like my own cost money to survive.
Either ads can cover the bills or visitors can pay directly. I'd rather
find ways to ensure that ads cover the bills. I've found that visitors like
subscription fees a heck of a lot less than they like ads.

Ben Kucenski
www.icarusindie.com
Jul 23 '05 #1
9 2104
> This can also be used for verifying that visitors are seeing your
ads. You
simply devise a script that is called which displays the ad which also counts the ad view. Ad views and hit counts then must match or the user is blocked from seeing the content.


Will this mean that the visitor will not see the content until all the
ads have been downloaded? This could really slow down the page on a
slow modem connection.

It still wouldn't guarantee that a user had seen your ads anyway. Check
out the Firefox adblock extension, it has a mode where it downloads the
ads, but the user just doesn't see them: http://adblock.mozdev.org/

Making visitors see ads is a losing battle anyway. The reason I block
ads when I surf the web is that banners are annoying, dishonest (the
fake dialog boxes) and irrelevant. Focus on making your ads relevant
like Google has and there won't be a problem.

Jul 23 '05 #2
Also how will your content be indexed by Google and other search
engines, since as far as I know Google doesn't evaluate and run the
javascript when it's crawling your site.

Jul 23 '05 #3
You can allow based on IP.

Google's bots googlebot in the reverse DNS lookup of the IP. You can't
spoof your remote IP with connection based protocols like TCP/IP. I used to
block all spiders except for Google using that.

But yes, that would be a problem. You'd need a whitelist of spiders.

"Matthew Lock" <lo******@gmail .com> wrote in message
news:11******** **************@ l41g2000cwc.goo glegroups.com.. .
Also how will your content be indexed by Google and other search
engines, since as far as I know Google doesn't evaluate and run the
javascript when it's crawling your site.

Jul 23 '05 #4
No, it doesn't slow down the page loading. That's why the first hit is free.
You're going to have 1 page hit and 1 javascript hit the first time the page
is loaded simply because that's the default. There's no way to wait until
the javascript runs before deciding whether or not to show the page. The
second time you'll have 2 of each since the call to the javascript happens
after the page is loaded and the new value is applied the next time a page
is loaded. Before the page is loaded the hit is counted and after the page
is loaded the javascript hit is counted. The page hit counts immediately
but the javascript hit counts on the next page view.

AdBlock would be unbeatable since it just doesn't display the image but
requests it. There's no way to tell what the client did with the image
after the request. If you wanted to break a EULA or few you could log every
IP and count hits and ad clicks. If an IP doesn't click an average of x ads
in y page views over z amount of time, you just show them ads until they
click enough to let them back in.


"Matthew Lock" <lo******@gmail .com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
This can also be used for verifying that visitors are seeing your

ads. You
simply devise a script that is called which displays the ad which

also
counts the ad view. Ad views and hit counts then must match or the

user is
blocked from seeing the content.


Will this mean that the visitor will not see the content until all the
ads have been downloaded? This could really slow down the page on a
slow modem connection.

It still wouldn't guarantee that a user had seen your ads anyway. Check
out the Firefox adblock extension, it has a mode where it downloads the
ads, but the user just doesn't see them: http://adblock.mozdev.org/

Making visitors see ads is a losing battle anyway. The reason I block
ads when I surf the web is that banners are annoying, dishonest (the
fake dialog boxes) and irrelevant. Focus on making your ads relevant
like Google has and there won't be a problem.

Jul 23 '05 #5
That's cloaking. I wouldn't go there if I was you:
http://www.google.com/webmasters/faq.html#cloaking

Jul 23 '05 #6
> If an IP doesn't click an average of x ads in y page views over z
amount of time,
you just show them ads until they click enough to let them back in.

Or just turn all your visitors away to other sites in disgust.

Jul 23 '05 #7
This is a last resort before going to subscriptions. If so many people
think they deserve a free ride to your site that your site is going bankrupt
attempting to be nice by using ads instead of requiring direct payments from
visitors, it would be in your best interest to turn those visitors who only
take and don't give, away. So them going away in disgust is the result
you're going for.

This is actually a growing problem with web-sites. People tend to believe
in the bandwidth fairy. This is a method to remind them that the bandwidth
fairy isn't real and that it costs real money to run a site. They can
either at least have to courtesy to view the ads or they can be forced to
pay a subscription fee out of their own pocket if blocking ads becomes a
real problem for the owner.

For my own site, AdSense pays the bills, blocking download agents and IP
bans for people who download unreasonable amounts keeps things in check.

I've banned maybe a dozen people in 4 years. Most people have common sense.


"Matthew Lock" <lo******@gmail .com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.com...
If an IP doesn't click an average of x ads in y page views over z

amount of time,
you just show them ads until they click enough to let them back in.

Or just turn all your visitors away to other sites in disgust.

Jul 23 '05 #8
If you are offering useful content why not try a Paypal or Amazon
donation link too.

Jul 23 '05 #9
You should read Slashdot.org. It's rediculous how many times I've seen an
open source project bitch about going under because nobody donated.

Meanwhile, taking an intelligent approach to their hosting would have
resulted in not going bankrupt on costs.

The fact is, donations don't work unless it's for some "worthy" cause.
People just simply don't throw down money on random sites if they don't have
to. I have donation links. They don't work. You donate to charities. You
don't donate to web-sites.

The only time I've seen donations actually work is when the web-site plays
begger and gives some sob story about costs and even then they usually only
get the finger. What web-sites usually do is offer free services and then
require a subscription fee for additional services. Most major sites have
done this or will do this.

This is what I was talking about with the bandwidth fairy. There are very
few large sites that don't have some kind of subscription program along with
ads.

The ads brings in the bulk of the cash since most people don't subscribe,
subscriptions from the hardcore fans and wannabe socialites then throw it
over the top if it isn't already.

Nobody does donations anymore except for special occasions. Asking for
donations is no different than begging for money and most sites simply don't
bother.

Like I said, people on the internet have seriously begun to believe in the
bandwidth fairy. They're like Homer Simpson when it comes to donations.
They don't want to look at ads, they don't want to subscribe (heck, the NYT
can barely get free subscriptions out of people) and they certainly don't
want to donate.

And that's why looking into technical solutions (like verifying that
javascript is enabled) before you run into a problem is a good idea. For
now you can use the technique for informational purposes only. Then later,
if needed, you can impose restrictions on people before you're filing
bankruptsy papers and whining that nobody is giving you money.

You can see now if say 50% of your visitors aren't using javascript which
could indicate possible problems in the future.

The sites that go under due to costs exceeding revenue fail to properly
think ahead and pretend that they can deal with it when it becomes a real
problem and for now they can just wait it out.

Ben Kucenski
www.icarusindie.com
----- Original Message -----
From: "Matthew Lock" <lo******@gmail .com>
Newsgroups: comp.lang.javas cript
Sent: Thursday, February 03, 2005 5:52 PM
Subject: Re: verifying client has javascript enabled - server side solution

If you are offering useful content why not try a Paypal or Amazon
donation link too.
"Matthew Lock" <lo******@gmail .com> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.com... If you are offering useful content why not try a Paypal or Amazon
donation link too.

Jul 23 '05 #10

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

Similar topics

1
7985
by: Vetrivel | last post by:
Application architecture : Develop interface between two existing systems, a. Enterprise CRM system b. Web based intranet system. Environment : Intranet Server : IIS and ASP. Script : VBScript and Javascript Client : 1. IE browser. 2. VBForm embedded with WebBrowser control (MS Internet
2
3250
by: Eric Linders | last post by:
Hi everyone. :-) Our site gets a ton of traffic on our contact forms, which collect the standard information (name, address, city, state, zip, home phone, etc.) The form validation is done with PHP. To eliminate (or at least deter) people wasting time submitting phony information, we can compare the state to the zip code (one DB table) and the zip code to the area code (another table in same DB).
10
3565
by: Chris Sharman | last post by:
I'm doing a rough validation of an email address client-side (using js), but it's not enough - our customer service people are apparently incapable of typing in an email address without error - we get spaces, missing '@', multiple '@' which we can field, and simple mis-spellings, which we can't. I'd like to automate a 'mailto:' popup for them on submit, along the lines of "thanks for your email address, just verifying I've got it right"....
6
7739
by: Stu Carter | last post by:
Hi, I have an aspx page where some controls are initially disabled by the code-behind 'Page_Load' event. I want these controls to be dynamically enabled when the user checks a checkbox. Because I don't want a post-back, I added some javascript to do this However, using client-side JS, I cannot enable any controls that have been disabled by server-side code. If the control is initially enabled, I can disable/enable it client-side.
2
1396
by: Charlie | last post by:
Hi: I would like to avoid a round trip to server for small things like changing enabled status of a dropdown list ASP.NET control. Can I apply client side scripting to change this property? Using the client side debugger, I see I can get a reference to control, but enabled property is not supported. Charlie
3
1927
by: UJ | last post by:
Can somebody help me please? I have two 'sets' of controls on a page. There are two radio buttons that enable the two sets (when radiobutton A is checked, set A should be enabled, B, Set B should be enabled). I know how to do it on the server side but not on the client side (I'd rather not have the page reload). Can somebody help me? I know I need to use Javascript but don't have a clue on how to do it. TIA - Jeffrey.
1
3950
by: Hong Hao | last post by:
Recently, I was trying to modify an existing aspx page when client-side validation on that page stopped working. I searched this group and the web in general and found that other people have had the same issue. However, none of the suggested fixes solved my particular problem. I tracked down the cause of the problem, which is related to aspx page parser's handling of controls inside html comments. The problem may be quite common and well...
2
1716
by: sonic | last post by:
I realize that if a field is disabled, its value will not be posted to server. i realize that .Enabled = false, produces disabled="disabled" markup i still don't see a good way to disable a field using javascript and than check for that on the server. if i render a regular textbox <asp:Textbox id="txt" runat="server" /> than on client do:
22
2938
by: Dan Rumney | last post by:
Hi all, I've been writing Javascript for quite a while now and have, of late, been writing quite a lot of AJAX and AJAX-related code. In the main, my dynamically generated pages are created using Perl on the backend, with Javascript providing limited frontend functionality. As an example, an expanding tree would be fully populated on the server-side and then presented to the browser, with Javascript and CSS being used to vary the...
0
8792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9266
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9209
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
6754
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
6054
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
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4826
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.