Pop up blocked or not?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sali63m
Forum Newbie
Posts: 2
Joined: Sat Jul 05, 2008 6:15 am

Pop up blocked or not?

Post by sali63m »

Let me ask my question as an example:

I have a site named mysite.com
I give you a code to place on your site and when a visitor sees your site, a pop up appears (which is a page defined in mysite.com/popup.php)
your code is : <script language=JavaScript src=http://www.mysite.com/popup.php?id=x></script>

and for each unique visitos you get 1 point by me.

The problem is this: when someone that has popup blocker visits your site he doesnt see the popup but you get 1 point.

How can i prevent this? and how can i define whether popup executed or not?
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Re: Pop up blocked or not?

Post by miro_igov »

You can add a small 1x1px image somewhere in the pop up content and this image will be with source fx. award_points.php?id=xx , however this is easy for abuse and you should think of some security if you are afraid from people opening award_points.php?id=xx for getting points. Such protection could be done with cookies, etc.
sali63m
Forum Newbie
Posts: 2
Joined: Sat Jul 05, 2008 6:15 am

Re: Pop up blocked or not?

Post by sali63m »

unfortunately popup pages are not in my control and are other people page.
so i haven't any access to them.
The only file I have access is mysite.com/popup.php which do all the popup work and also adds point - even when they are blocked :(
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Pop up blocked or not?

Post by Eran »

You can handle this in two ways: use a redirect header with a small delay (say 100ms) to the actual add, so if the window was closed before that it won't reach the add (and add to the count). Alternatively you can implement the same idea using a javascript timeout (setTimeout())
Post Reply