0
How can I display an alert box when anyone access this code with any device except desktop or laptop?
3 ответов
+ 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
+ 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();
+ 1
thank you