Lunarpages Web Hosting Forum

Author Topic: how to create a pop-up that only appears on mobile devices.  (Read 3355 times)

Offline gr8_boi52

  • Trekkie
  • **
  • Posts: 10
this is what i want.   :thumb:
when someone visits my site on any mobile device, a pop-up appears and it says that "please consider using this site from a PC because this website is not mobile-optimized, and we are working on it" and there a button that says "continue anyway".
i am a newbie at coding..  :-? 
plz help  :help:

Offline MrPhil

  • Senior Moderator
  • Berserker Poster
  • *****
  • Posts: 6427
Re: how to create a pop-up that only appears on mobile devices.
« Reply #1 on: April 06, 2013, 08:33:36 AM »
That's a good way to lose visitors permanently. It's as bad as the sites that still say, "for best results, use Internet Explorer 6 to view this site". At most, the pop-up could say "Please bear with us while we work on a way to better accommodate mobile visitors." Even then, a pop-up is likely to greatly annoy some of your visitors (they have to take action to dismiss the pop-up). Do you really need this?

I'm not sure how to determine if the user is on a mobile. Perhaps the HTTP USER_AGENT (PHP: $_SERVER['HTTP_USER_AGENT'])  could be useful, although I don't know what specific values to look for. You may have to do some research on your own. Since you haven't said what kind of software you're using (as a self-described coding newbie, I would presume you're using a canned application), I can't help you beyond that. Certainly any supported canned application should have either a tech support or a community forum to ask about such things in (detecting mobile users and how to do a pop-up). You can look at the source code of something like SMF ( forum to see how they try to detect various classes of mobile users and tailor the output to them.
Visit My Site

E-mail Me
-= From the ashes shall rise a sooty tern =-