Support Forums for LiveMesh Themes & Plugins › Forums › Appdev Theme Support › Can Get App button handle multiple systems?
- This topic has 3 replies, 2 voices, and was last updated 11 years, 1 month ago by livemesh.
-
AuthorPosts
-
October 16, 2013 at 6:40 pm #2255sq2dMember
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,
FrankOctober 17, 2013 at 10:30 am #2267livemeshKeymasterIf 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/9038625/detect-if-device-is-ios
October 17, 2013 at 3:59 pm #2280sq2dMemberThanks 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,
FrankOctober 18, 2013 at 12:39 pm #2288livemeshKeymasterThe 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.
-
AuthorPosts
- The forum ‘Appdev Theme Support’ is closed to new topics and replies.