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 ?


 452

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 (%)
51%



The most helpful COFFEESCRIPT solutions

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

Click to see more ...

  705     79

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

Click to see more ...

  476     42

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

Click to see more ...

  452     39

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

Click to see more ...

  278     36

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

Click to see more ...

  215     31

detect browser coffeescriptdetect browser coffeescriptCOFFEESCRIPT

Click to see more ...

  257     27

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

Click to see more ...

  218     16

get client country using coffeescriptget client country using coffeescriptCOFFEESCRIPT

Click to see more ...

  157     14

get latitude longitude coffeescriptget latitude longitude coffeescriptCOFFEESCRIPT

Click to see more ...

  190     9

get client latitude longitude using coffescriptget client latitude longitude using coffescriptCOFFEESCRIPT

Click to see more ...

  99     9