Support » Everything else WordPress » OS specific download link – How to???

  • Hi, could anyone help. I have a remote support link on my site for clients to download an APP to allow them to use remote access with me.

    Is there a way (i see it on larger company sites)

    That i could have a .EXE file for windows users and a .DMG for my mac clients but just have one link, the user clicks this then the site determines the OS and gives them the correct one?

    Thank you


Viewing 3 replies - 1 through 3 (of 3 total)
  • esmi


    Forum Moderator

    What does this have to do with WordPress?

    Well i want to use this feature on my wordpress site…

    Moderator Pippin Williamson


    Pippin's Plugins and Plugin Reviewer

    This is pretty simple to do. First you need to write a function to detect the OS that the visitor is using:

    function pw_get_browser_os() {
    	// A little Browser detection shall we?
    	$browser = $_SERVER[ 'HTTP_USER_AGENT' ];
    	// Mac, PC ...or Linux
    	if ( preg_match( "/Mac/", $browser ) ){
    		$os = 'mac';
    	} elseif ( preg_match( "/Windows/", $browser ) ){
    		$os = 'windows';
    	} elseif ( preg_match( "/Linux/", $browser ) ) {
    		$os = 'linux';
    	} else {
    		$os = 'unknown-os';
    	return apply_filters( 'pw_get_browser_os', $os );

    Now you can use that function in your template file when outputting the download link:

    $os = pw_get_browser_os();
    if( $os ) == 'mac' ) {
    	// output the OS X download link
    } else if( $os == 'windows' ) {
    	// output the Windows link
    } else if( $os == 'linux' ) {
    	// output the Linux download link
    } else {
    	// not a known OS, so perhaps hide the link
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘OS specific download link – How to???’ is closed to new replies.