Algorithms, Blockchain and Cloud

Tiny Javascript Function to Redirect to Different Pages Given Different Screen Resolution


If you want to improve user experience when browsing your website, given that you know the screen resolution they are on, then the following is a quick Javascript solution that works like a charm.

<script language='javascript'>
	function redirect() {
		if (screen.width == 1024) location.href = "1024.html";
		else if (screen.width == 800) location.href = "800.html";
		else return(false);
	}
	redirect();
</script>

Although, I doubt that how many internet users are still using these ‘low’ screen resolution e.g. 1024 or 800 width.

–EOF (The Ultimate Computing & Technology Blog) —

108 words
Last Post: Loop Implementation at Windows Batch Programming
Next Post: C/C++ Coding Exercise - Recursive Computation of Value e

The Permanent URL is: Tiny Javascript Function to Redirect to Different Pages Given Different Screen Resolution (AMP Version)

Exit mobile version