Smart download button


(Pablo Aranegui) #1

Thanks for your time.
I would like to offer a free wallpaper download link service to my customers (once they login in members area). I want to do it the simplest way: just a download button, so the system detects the customers screen resolution and choose the appropiate file to download from my server. Clients don’t need to read a long list of devices (mobiles, tablets…)
So in theory: First step, detect resolution from javascript or whatever. Second step, accordinly with the data collected link the button to the right file in order to download it.
I think is a good idea but I’m not able to achieve it. Thanks for your suggestions.
Pablo


(Will Woodgate) #2

I don’t know how reliable this is, but there is a suggestion here you can fetch the screen width and height using Javascript: http://www.w3schools.com/jsref/prop_screen_width.asp

Like I say, I don’t know how reliable this is (taking into account of retina screens, handheld devices and multi-monitor configurations). But if you can get the dimensions of the customers screen (not just the browser window) then you could pass these variables through a function of ‘if’ and ‘else if’ statements to determine which download link to display on the page. You might need to hire a developer if you don’t have much Javascript experience.

The download link probably just needs to be a regular link or button to the appropriately sized image file, with a download attribute to force the image to download and be named correctly in web browsers that support downloads:
http://www.w3schools.com/tags/att_a_download.asp

A second idea might be to use something like my free RottenApple stack that can detect what sort of device is accessing your website and display content conditionally, e.g. iPhone, iPod, iPad, Android, Windows Phone or Blackberry or none of the above. Then you could display the relevant link or download button for the most appropriate desktop background size.


(Pablo Aranegui) #3

Thank you Willwood. You are right. I should hire a developer (although I don’t know where to find them and how much it cost.Beside I need to be able to update by myself the download links every month.) So first I think I am going to try your RottenApple stack.