COFFEESCRIPT detect mobile device not tablet coffeescript - Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Just a Web Code Solution

How to detect mobile device not tablet using coffeescript ?


 422

Show ResultCOFFEESCRIPT


2

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
</head>
<body>
<script type="text/coffeescript">

$ ->
@mobileWeb = (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))
screen_width = (screen.width)

if @mobileWeb && screen_width <= 768 then $("#mydiv").text "mobile device"
else if @mobileWeb && screen_width > 768 then $("#mydiv").text "tablet"
else $("#mydiv").text "desktop"

</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/coffee-script/1.7.1/coffee-script.min.js"></script>
<div id="mydiv" style="color:black"></div>
</body>
</html>


By     Created   
The power of the user (%)
45%



The most helpful COFFEESCRIPT solutions

how to set color using coffeescript ?how to set color using coffeescript ?COFFEESCRIPT

Click to see more ...

  657     75

How to get ip address using coffeescript ?How to get ip address using coffeescript ?COFFEESCRIPT

Click to see more ...

  426     42

How to detect mobile device not tablet using coffeescript ?How to detect mobile device not tablet using coffeescript ?COFFEESCRIPT

Click to see more ...

  422     39

How to detect the browser opera using coffeescript ?How to detect the browser opera using coffeescript ?COFFEESCRIPT

Click to see more ...

  265     34

how to create alert using coffeescript ?how to create alert using coffeescript ?COFFEESCRIPT

Click to see more ...

  206     31

how to create callback using coffeescript ?how to create callback using coffeescript ?COFFEESCRIPT

Click to see more ...

  192     16

get client country using coffeescriptget client country using coffeescriptCOFFEESCRIPT

Click to see more ...

  151     14

detect browser coffeescriptdetect browser coffeescriptCOFFEESCRIPT

Click to see more ...

  138     12

get client latitude longitude using coffescriptget client latitude longitude using coffescriptCOFFEESCRIPT

Click to see more ...

  88     9

detect mobile coffeescriptdetect mobile coffeescriptCOFFEESCRIPT

Click to see more ...

  101     8