lib/mobileesp.rb
def detect_windows_mobile
      # Exclude new Windows Phone 7.
      return false if detect_windows_phone7

      #Most devices use 'Windows CE', but some report 'iemobile'
      #  and some older ones report as 'PIE' for Pocket IE.
      #  We also look for instances of HTC and Windows for many of their WinMo devices.
      return true if ( !@user_agent.index(DEVICE_WIN_MOB).nil? ||
        !@user_agent.index(DEVICE_IE_MOB).nil? ||
        !@user_agent.index(ENGINE_PIE).nil? ||
        (!@user_agent.index(MANU_HTC).nil? && !@user_agent.index(DEVICE_WINDOWS).nil?) ||
        (detect_wap_wml && !@user_agent.index(DEVICE_WINDOWS).nil?) )

      # Test for Windows Mobile PPC but not old Macintosh PowerPC.
      !@user_agent.index(DEVICE_PPC).nil? && @user_agent.index(DEVICE_MAC_PPC).nil?
    end
# Detects if the current browser is a Windows Phone 7 device.
Detects if the current browser is a Windows Phone 7 device.
Detects if the current browser is a Windows Phone 7 device .
def detect_windows_mobile
      return false if detect_windows_phone7
      return true if ( !@user_agent.index(DEVICE_WIN_MOB).nil? ||
        !@user_agent.index(DEVICE_IE_MOB).nil? ||
        !@user_agent.index(ENGINE_PIE).nil? ||
        (!@user_agent.index(MANU_HTC).nil? && !@user_agent.index(DEVICE_WINDOWS).nil?) ||
        (detect_wap_wml && !@user_agent.index(DEVICE_WINDOWS).nil?) )
      !@user_agent.index(DEVICE_PPC).nil? && @user_agent.index(DEVICE_MAC_PPC).nil?
    end
def detect_windows_mobile return false if detect_windows_phone7 return true if ( ! @user_agent . index ( DEVICE_WIN_MOB ) . nil? || ! @user_agent . index ( DEVICE_IE_MOB ) . nil? || ! @user_agent . index ( ENGINE_PIE ) . nil? || ( ! @user_agent . index ( MANU_HTC ) . nil? && ! @user_agent . index ( DEVICE_WINDOWS ) . nil? ) || ( detect_wap_wml && ! @user_agent . index ( DEVICE_WINDOWS ) . nil? ) ) ! @user_agent . index ( DEVICE_PPC ) . nil? && @user_agent . index ( DEVICE_MAC_PPC ) . nil? end
Detects if the current browser is a Windows Phone 7 device.
Detects if the current browser is a Windows Phone 7 device .
# Exclude new Windows Phone 7. #Most devices use 'Windows CE', but some report 'iemobile' #  and some older ones report as 'PIE' for Pocket IE. #  We also look for instances of HTC and Windows for many of their WinMo devices. # Test for Windows Mobile PPC but not old Macintosh PowerPC.