Read more about web design Cork and drop us a message!

Demo

Demo text below, use mobile device or simulator to view it:

Demo text start – – Demo text stop

pro_mobile:

Handy little wrapper tag to display different content/code to mobile browsers, needed it, made it, shared it :)

Version 0.4, ‘opera mobi’ agent supported now!

Download at GitHub

pro_mobile_v0.4.txt

pro_mobile_v0.4_zip.txt

Option 1:

<txp:pro_mobile> // Show mobile content here </txp:pro_mobile>

Option 2:

Use as an if/else:

<txp:pro_mobile> // Mobile content here <txp:else /> // Regular content here </txp:pro_mobile>

Option 3:

Define custom content per browser

<txp:pro_if_mobile name="iPad" > You have an iPad lucky thing! </txp:pro_if_mobile>

Names available for you to use include:

  • iphone
  • ipod
  • ipad
  • aspen
  • nexus
  • dream
  • android
  • cupcake
  • blackberry9500
  • blackberry9530
  • opera mini
  • opera mobi
  • webos
  • incognito
  • webmate

Option 4:

Feel free to wrap tags!

<txp:pro_mobile> Welcome mobile user! <txp:pro_if_mobile name="opera mini"> You use opera mini, great browser! </txp:pro_if_mobile> <txp:pro_if_mobile name="android"> You use android, great browser! </txp:pro_if_mobile> <txp:else /> // normal content </txp:pro_mobile>

You can do a lot with media queries in the head of your textpattern page, see this article for code examples on how to create mobile version of your site with media queries alone, however there will still always be times you want a custom message, such as a custom Ipad message with instructions on how to add that page to the home screen etc. But I would recommend a heavy reliance on media queries over device ‘sniffing’ for your overall tactic, do post any questions/feedback here too!

- Posted - Categories

Back to Top

Random Web Design Testimonials

Hilary at her Company Proximo Design created a webpage for me at Gourmet Burger Bistro this year. I wanted to get it up and running quickly and I could not have been more satisfied with the speed and quality of her results.
Best of luck in the future Hilary and I look forward to continuing our business relationship.
Michael Condon
Gourmet Burger Bistro

Michael Condon Owner, Gourmet Burger Bistro