John
John

Reputation:

Opening Javascript based popup ads on the same page

I own an image hosting site and would like to generate one popup per visitor per day. The easiest way for me to do this was to write a php script that called subdomains, like ads1.sitename.com ads2.sitename.com

unfortunatly most of my advertisers want to give me a block of javascript code to use rather than a direct link, so I can't just make the individual subdomains header redirects.I'd rather use the subdomains that way I can manage multiple advertisers without changing any code on page, just code in my php admin page. Any ideas on how I can stick this jscript into the page so I don't need to worry about a blank ads1.sitename.com as well as the popup coming up?

Upvotes: 1

Views: 1657

Answers (4)

Mat
Mat

Reputation: 86474

Hey, cut the guy some slack. Popups might not be very nice, but at least he's trying to reduce the amount of them. And popup blockers are going to fix most of it anyway. In any case, someone else might find this question with more altruistic goals (not sure how they'd fit that with popups, but hey-ho).

I don't quite follow your question, but here's some ideas:

  • Look into Server Side Includes (SSI) to easily add a block of javascript to each page (though you could also do it with a PHP include instead)
  • Do your advertiser choosing in your PHP script rather than calling the subdomains
  • Decipher the javascript to work out what it's doing and put a modified version in the subdomain page so it doesn't need an additional popup. Shouldn't be too hard.

Upvotes: 0

Jordy Boom
Jordy Boom

Reputation:

How about appending a simple window.close() after the advertising code? That way their popup is displayed and your window closes neatly.

I'm not sure that I've ever had a browser complain that the window is being closed. This method has always worked for me. (IE, Firefox, etc.)

Upvotes: 1

Grant Wagner
Grant Wagner

Reputation: 25931

At the risk of helping someone who wants to deploy popup ads (which is bound to fail due to most popup blockers anyway), why can't you just have the subdomains load pages that load the block of Javascript the advertisers give you?

Upvotes: 0

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114367

I doubt you'll find much sympathy for help with pop-up ads.

Upvotes: 2

Related Questions