Close Search Box
Search Box

Search: From:

Close
Newsletter

9Tutorials to your Inbox



Interstitial pages with javascript

Interstitial pages with javascript
Author lv1 (3100/5000)
2,147 views
1 Star2 Star3Star4 Star5 Star (2 votes, average: 3 out of 5)

When you click on a link, an interstitial page (usually an advert) appears before you are shown the new page that you clicked to view. doInterstitial() is a simple javascript function that rewrites all links on a page.

and can be called on page load (passing the advert url and a time duration for the advert):

The following demonstrates a simple interstitial advert. Its basic function is to wait for a defined duration and then forward the user to their desired page.

The GET variables are parsed from the url, and used to find the duration and destination.

The biggest trick is the location.replace line which removes the advert from the history, stopping it appearing when the back button is pressed.

Copyright @ BrandNewBox 2007

del.icio.us:Interstitial pages with javascript  digg:Interstitial pages with javascript  spurl:Interstitial pages with javascript  newsvine:Interstitial pages with javascript  blinklist:Interstitial pages with javascript  furl:Interstitial pages with javascript  reddit:Interstitial pages with javascript  blogmarks:Interstitial pages with javascript  Y!:Interstitial pages with javascript  magnolia:Interstitial pages with javascript  segnalo:Interstitial pages with javascript

Post a Comment »








Safari hates me

Comment Guidelines

  • Hyperlinks are automatically generated.
  • <em>italic</em>
  • <strong>bold</strong>
  1. rakim September 7, 2007

    I still can;t get it to work. can you please post some demo somewhere? thx