0

We make two version setup packages, win-32.msi and win-64.msi, and put them to our website for user to download.

But I just want to using one web link. When user using windows-32bit OS to click the link, he would get the win-32.msi, using windows-64-bit OS would get win-64.msi.

We use php, js, html in our web code, setting in apache.

There was a method we used before: browsercap.ini. But we found IE10 browser in win8-64bit give us win8-32bit information which was wrong.

So are there any other solutions?

2
  • please check link: stackoverflow.com/questions/17641454/… may be this will help you Commented Oct 16, 2013 at 6:04
  • Thanks a lot. I want to know the OS bit version, 32 or 64. browsercap.ini has the full information. It worked well at almost time, but win8-64 IE10 would be wrong.. Commented Oct 16, 2013 at 6:15

2 Answers 2

1

In Javascript you can use the navigator object to get some info about the local system:

console.log(navigator.appVersion);    

On my system this yields:

5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36

You can then parse this to work out where to send the user.

Sign up to request clarification or add additional context in comments.

Comments

1

As an alternative you can do this in Apache as well by using mod_rewrite and looking at the HTTP_USER_AGENT variable. More information about this can be found in the mod_rewrite documentation.

Something like this could work:

RewriteEngine On

RewriteCond %{HTTP_USER_AGENT} (WOW64|OtherMatch)
RewriteRule ^(/path/to/dl-packages)/win-32.msi $1/win-64.msi [R,L]

This is more to show the basic consept and you might want to fine tune the (WOW64|OtherMatch) string that should match the 64bit clients, not sure if WOW64 will match all Windows 64 bit browsers. Also I am matching the URL to the win-32.msi package in my RewriteRule that would be the default package, and if a 64bit client try to get it it will be redirected to the 64 bit version instead. Depending on your site, you might want to handle this differently.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.