-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WEB: Add a "Recommended download" button to the downloads page #8
Conversation
The idea has been taken and adapted from the VideoLAN web site (http://www.videolan.org). A big 'download' button is shown, which links to the most appropriate version for the user, depending on the OS reported by the user's browser. Only OSes with a browser have been added. Known browser user-agent strings have been taken from http://user-agent-string.info/list-of-ua/os
I think this is a good idea (and I also think we had some plans on this in the past, it feels much too familiar at least ;-)). However, I'm not sure about this particular implementation. It looks like we will have to maintain another instance of "what's the current version" in javascripts/recommended_dl.js now (i.e. in addition to the list in downloads.xml). IMHO it would be better if we could merge this to reduce the duplication and lower maintaince burden. Also, Windows is default? That sounds just wrong, I think it makes more sense to not show any download button in that case or to link to the sources. I will try to actually test this later and see how it behaves in practice. |
Thanks for the feedback :) The Windows version has been set as default because of the significantly larger number of downloads it has compared to the others - check the download stats for version 1.6.0 on SF: We could remove the default, and not show a button at all if Javascript is disabled, or if the user's system isn't recognized from the browser's user-agent string. Theoretically, it is possible to just generate the Javascript download array for the script, but we'll need to add another tag to each download (the user-agent string to look for) - the other data is already there. I'll check if it's feasible. |
Add a new XML field, "user_agent", used to find the user agent string where the download item in question will be suggested to the user. Only items with the "user_agent" field can be provided as recommended downloads
Recommended downloads are created automatically from the XML data now. Only the downloads with the new "user_agent" field are picked to be presented as recommended downloads. I'll leave the "Windows" entry as default, based on the number of downloads we have for the Windows version compared to the others. It's better to have a button that shows a recommended download, rather than having a blank spot there. |
Defaulting to Windows really makes no sense. If you're on Windows, then you'll get the Windows button. Otherwise, why would you be given Windows as default? If I use say, my Wii browser, why should I get Windows as the default? It's irrelevant how many people download the Windows builds; it's far better to not show the button (or the section) if the platform is not known. |
We also need to take padding into account, which was omitted in the previously updated images
Also, the creation of the button itself has been pushed to Javascript. The recommended d/l section is now only shown if JS is enabled and an appropriate user-agent has been matched
@clone2727 : The idea was that some users disable Javascript in their browsers (e.g. via the noScript addon). Also, some antivirus software may change the user-agent string. This was why the Windows (i.e. the most popular) package was shown. I've changed this behavior, so if a user has Javascript disabled, or if no user-agent match is found, then the recommended download button (and the whole section) isn't shown at all |
I've uploaded this for testing to: |
This doesn't work at all for the Mac-downloads right now, changing the User Agent in Safari triggers the Windows-dialogue just fine, both for faking IE and faking Firefox (Windows), but the instant I try to use any Mac-user agent, I won't get anything at all here. For the record, the default user agent I have is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9) AppleWebKit/537.71 (KHTML, like Gecko) Version/7.0 Safari/537.71 |
@somaen: Ah, I see. In downloads.xml, the user-agent (inside the user_agent field) for the Mac downloads is defined as "MacOS". I just changed it to "Mac OS X" on the testing website. Can you try again? |
It works now. If I might suggest putting the OS-logo alongside the os-identifier in that box, to make it a tad clearer what gets downloaded though? It isn't as important now that the default to Windows has been removed (in which case it would be really bad not to do so). Otherwise, well done.
|
It looks good to me. But is that supposed to work on Linux? I see you have added user-agents for Linux downloads in the download.xml file (e.g. Debian/Ubuntu/SlackWare/Fedora) but I have never seen web browser using those in their user agent. I tested your page on my Debian machine and on my Ubuntu VM and in both cases I don't get the button. For example on Debian I have: Note: sf.net gives me the source package as recommanded download when it detects Linux. Should we do the same? The current solution of not having the button is fine with me as well. |
@criezy: Thanks for testing. I got some of these user-agent strings from the VideoLAN site code. As we do have compiled packages for *nix systems, perhaps it would be best if we just don't offer a recommended download button for any *nix flavor? |
Now that I am home I tested it on my mac with all the browsers installed. It worked with Safari, Opera and Chrome but not with Firefox. Firefox user agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:25.0) Gecko/20100101 Firefox/25.0 |
Interestingly, it DOES work in Safar, when I tell Safari to fake Firefox Mac's User Agent, which then returns: |
I tested on a couple platforms and browsers. It seems iPhone/iPad are not detected correctly and I can confirm MacOSX /Firefox is not working at all [1]:
[1] You also happen to be using undefined values starting at recommend_dl.js:32 as versions[OS] is undefined when OS == "" |
Many thanks for the feedback @somaen, @criezy and @Littleboy! Much appreciated :) I've hopefully fixed the Mac + iPhone/iPad detection, plus fixed the undefined variables issue. Could you please test again? Both PPC and Intel Macs, as well as iPhone/iPad should be correctly identified now. Also, concerning *nix: should we provide a download to the source code, or no download at all? I'm in favor of the latter, as it's impossible to distinguish the *nix flavor used from the user-agent. |
Apparently, there are some versions of Firefox and Chrome that include the "Ubuntu" string in their user-agent: Not sure if these are release or development versions, or custom user agent strings, modified by users themselves. Edit: Seems like this isn't reliable at all: So IMHO it's not worth trying to distinguish *nix versions at all. I'll remove them completely for now |
It's not possible/reliable to distinguish *nix flavors from the web user-agent.
If we cannot distinguish the *nix flavor I agree with having no recommended download. |
I have rested on Mac. Now all browsers (including Firefox) propose the Mac download as preferred download. I also checked on iPad and I get the iPhone download as preferred download. I have no idea if it can be used on a jailbroken iPad though - mine isn't and doesn't allow any download. And I am not sure if it is a good idea to have a big red button shouting CLICK ME if it cannot be used. |
@criezy: Granted, there are some versions of Firefox that had the "Ubuntu" string in their user-agent, but according to this page, linked from that bug: As for iPhone/iPad: indeed, only jailbroken phones with iOS can download ScummVM, but I assume that this is already known, regardless of the existence of a recommended download button. If a user is browsing the downloads page with an iPhone/iPad, it is assumed that he wants to download ScummVM. |
It seems that the "Ubuntu" string is part of the user-agent for some browser versions in Ubuntu, thus we could use it for our recommended download button, if the string exists
If all the issues have been resolved, I'll go ahead and merge this on Sunday evening, as all the major issues have been identified and addressed. Any further tweaks and changes can be done on master. |
OK to merge from me |
I gave it a really quick check with JavaScript disabled on my Linux system and everything seems to work fine (i.e. it looks just like what we have currently). |
WEB: Add a "Recommended download" button to the downloads page
The idea has been taken and adapted from the VideoLAN web site
(http://www.videolan.org). A big 'download' button is shown,
which links to the most appropriate version for the user, depending
on the OS reported by the user's browser. Only OSes with a browser
have been added. Known browser user-agent strings have been taken
from http://user-agent-string.info/list-of-ua/os