Treehouse: Grow your CSS skills. Land your dream job.

Load different header file if IPAD views website using PHP includes?

  • # October 27, 2011 at 8:03 am

    OK, here’s my problem.

    I have a website with a flash animation in the header section. The header section (file) is loaded by using a standard PHP include. However, when viewed with an ipad the flash animation does not work. Is it possible to detect the ipad coming into the site and somehow load a different header file without the flash animation? (Don’t really want to build an ipad version of the website for such a small issue.)

    Totally new to PHP – have only used very basic functions like includes etc.

    Thanks in advance for any help or guidance.

    John C

    # October 27, 2011 at 12:30 pm

    What are you looking to replace the Flash ani with.. video? image? slider?

    I know I have used Flash as a fallback, but I think you can do vice-verse too with HTML5 video embed… just change the order of the sources.

    # October 29, 2011 at 11:56 pm

    David Walsh has an article on iPad detection, and shows how to do it in PHP quite simply. Once you’ve got whether iPad is supported into a boolean, you can just use an if/else statement to load the different headers.

    # October 30, 2011 at 4:05 am

    Just pick a flash embed that shows alt content when flash is not supported. Works perfect for me.

    # October 31, 2011 at 6:54 am

    Thanks for all of the responses. Will try your suggestions and report back

    John C

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.