Can Get App button handle multiple systems?

Support Forums for LiveMesh Themes & Plugins Forums Appdev Theme Support Can Get App button handle multiple systems?

Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2255
    Sq2dsq2d
    Member

    Hi, I’m interested in using the theme for a site to allow users to download either iOS, Android, Mac desktop, or Windows desktop apps. I see in the Theme Options > Header, that there is a single field to enter a URL for the App linked to by the Get App button. Is there any way to expand upon this to accommodate multiple system app downloads?

    I’m thinking we would need to disable the built-in Get app button in place of a customized one with some kind of script to auto-detect what system is currently accessing the site and thus be directed to the correct app download.

    Regards,
    Frank

    #2267
    Livemeshlivemesh
    Keymaster

    If I understand your question right, you want to change the download link based on the OS from which the user is visiting the page. May guess is that you don’t need to disable the Get App button; you will need to change the URL of the Get-App button in the Javascript based on the OS detected –

    p = navigator.platform;
    
    download_link = "http://www.app-download.com/";
    
    if( p === 'iPad' || p === 'iPhone' || p === 'iPod' ){
        download_link = "http://www.app-download.com/app";
    }
    else if (p.toUpperCase().indexOf('MAC')!==-1) {
    download_link = ""http://www.app-download.com/mac-app";
    }
    else if (p.toUpperCase().indexOf('WIN')!==-1) {
    download_link = ""http://www.app-download.com/windows-app";
    }
    else if (p.toUpperCase().indexOf('LINUX')!==-1) {
    download_link = ""http://www.app-download.com/linux-app";
    };
    
    $("#get-app-button").attr("href", download_link);
    

    Here is some more information on how to detect the OS –

    http://stackoverflow.com/questions/1741933/detect-64-bit-or-32-bit-windows-from-user-agent-or-javascript

    http://stackoverflow.com/questions/9038625/detect-if-device-is-ios

    #2280
    Sq2dsq2d
    Member

    Thanks livemesh! I think this could be helpful for a lot of your theme users! So should I leave the field for “URL for the App linked to by the Get App button” blank or enter “#”? Would the best place to put this be in the header.php or footer.php files? Any plans on enabling hooks within the Theme Options to allow for customization that will stay intact?

    Thanks,
    Frank

    #2288
    Livemeshlivemesh
    Keymaster

    The above code will be part of the js/main.js file. You will have to modify it. You can specify any default URL of your choice – best to create a separate page which has links to various OS download pages just in case Javascript fails or when you are not able to detect the OS. You can control the default href through the options panel and hence can change anytime.

    I will consider adding option for this if there are more requests for the same. Till then, the above script should be a good enough solution. Hope you agree. Thanks.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Appdev Theme Support’ is closed to new topics and replies.