0

How can I display an alert box when anyone access this code with any device except desktop or laptop?

https://code.sololearn.com/WPXKz1IAUcxV/?ref=app

30th Jun 2018, 7:34 AM
B.D
B.D - avatar
3 Answers
+ 3
Add a media rule in CSS: @media (min-width: 640px) { body { display: none; } } would block all display for screen size above 640px https://code.sololearn.com/Wal9OhWPmskR/?ref=app
30th Jun 2018, 8:07 AM
CalviŐ˛
CalviŐ˛ - avatar
+ 2
For alert when it view by larger screen, add this JavaScript: function checkScreenWidth() { var maxWidth = 640; if(screen.width>maxWidth) { alert("The webpage is best view on mobile width of " + maxWidth + "px or less") } } checkScreenWidth();
1st Jul 2018, 4:04 AM
CalviŐ˛
CalviŐ˛ - avatar
+ 1
thank you
1st Jul 2018, 4:07 AM
B.D
B.D - avatar