根据用户是Mac还是PC更改链接目标 [英] Change link destination based on whether user has mac or PC
问题描述
是否可以根据用户使用javascript的Mac还是PC来更改链接的目的地?
Is it possible to change the destination of a link based on whether the user has a mac or a PC using javascript?
举个例子:Apple网站允许下载Quicktime,但它知道您使用的是Mac还是PC,并将您定向到相关页面。
To give an example: The Apple website allows download of Quicktime but it "knows" whether you are using a mac or a pc and directs you to the relevant page.
这样做的背景/原因:我有为某人建立了一个网站,他们那里有许多音频和视频文件。理想情况下,他们希望这样做,以便如果用户使用的是Mac,它将下载该文件的QuickTime版本,但是如果使用PC的用户,则将下载Windows Media Player文件。
Background/Reason for doing this: I have built a website for someone and they have a number of audio and video files on there. Ideally they want it so that if the user is on a mac it will download a quicktime version of the file but if they are on a PC it will download a Windows Media Player file.
欢呼
CHRIS
推荐答案
您可以检查UserAgent标头,用于区分Mac和PC浏览器。
You can check the UserAgent header to tell Mac and PC browsers apart.
这篇关于根据用户是Mac还是PC更改链接目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!