Show DevBest Screen resolution (JavaScript)

Dan3212

Member
Mar 30, 2016
86
10
I'm not sure about the whole forum rules here but I'd like to post here about 1 small piece of code to let a user's website send an alert once pageload to display the screen resolution:

Code:
function screenresolutionalert()
{
window.alert("Screen resolution: " + screen.height + ' x ' + screen.width);
}

or if you just want it as text:

Code:
function screenresolutionalert()
{
document.write("Screen resolution: " + screen.height + ' x ' + screen.width);
}

make sure you add to your body tag:

<body onload="screenresolutionalert();">
 

Users who are viewing this thread

Top