Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2007
    Posts
    43
    Plugin Contributions
    0

    Default Redirecting Mac users - adding JavaScript on index.php?

    Hi,

    I've tried searching on this but can't seem to find exactly what I am looking for. My site sells WMV-HD digital downloads that, due to DRM protection, aren't playable on the Mac platform.

    I would like to add some JS to my main catalog page that will redirect all Mac users to my mac.html page, which gives them info about the incompatibility and provides links to product categories in the catalog that they can purchase, like Blu-Ray discs. The JS I want to use is something like this, in the <HEAD> area of my index.php:


    Code:
    <SCRIPT LANGUAGE="JavaScript">
    if (navigator.platform.indexOf('Win') == -1)
       window.location=('mac.html');
    </script>
    Which I hope is correct; I don't have a Mac to test it on.

    I've also read several sites which give info on doing the Mac redirect via PHP, however I thought this route would be the easiest.

    So my questions are: in which .php files (and where) do I need to add this JS statement so it will show up in the <HEAD> section of my index.php catalog page? And will this little JS do what I am trying to, in redirecting all Mac OS users to the mac.html page?

    Thanks in advance for any help.

    Patrick

  2. #2
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Redirecting Mac users - adding JavaScript on index.php?

    Put the code you posted above into a new file:

    /includes/templates/YOUR_TEMPLATE_NAME/jscript/jscript_redirect_mac.php

    Zen Cart will automatically put it into the right spot in your page head.


    Yes, it works on the mac, at least in Safari, Firefox, and Opera ... running on Leopard (OSX 10.5).
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Oct 2007
    Posts
    43
    Plugin Contributions
    0

    Default Re: Redirecting Mac users - adding JavaScript on index.php?

    DrByte,

    THANKS VERY MUCH! I put the code into a new jscript_redirect_mac.php file, into my cherry_zen/jscript/ directory.

    Will test out on a Mac soon. Thanks again, you're a lifesaver. This will help a lot, to avoid Mac users purchasing the WMV-HD videos and then realizing they can't play them.

    Best,
    Patrick

 

 

Similar Threads

  1. Replies: 0
    Last Post: 19 Jun 2011, 09:03 PM
  2. Replies: 1
    Last Post: 30 Dec 2008, 07:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg