"We Have an App!" Alert - How to make it?

I visit a lot of sites with my iphone and am used to getting the “Download App” alert or “We Have an iPhone App” alert that says yes/no. Is this simple javascript, or is there another way of doing this.

I’ve noticed that once I say NO, I can still browse the site without the alert coming back. So I’m assuming a bit more to it than a single javascript function.

I now have an iPad and iPhone app and I want the same alert, but how do I do this?

All feedback appreciated.


Javascript + cookie.