Viewport detection and redirection to another homepage

I want to redirect the home page to a different view if the initial viewport is a certain dimension. I thought about it with javascript and did the redirection in the head tag. Is this the best possible way, or can I discover something on the server side first?

+4
source share
2 answers

You cannot determine the size of the viewport on the server; you need to do this on the client side.

Forwarding on the client side may not be the best solution, as it is difficult and harmful to search engines. Instead, you can use media queries to apply different stylesheets (or cascades) designed for different ranges of screen resolutions without server-side interaction.

+4
source

Browser / browser window size detection cannot be performed on the server side. You can do this with Javascript. Please note that you do not need to redirect, you can download alternative content based on the viewport size using AJAX.

0
source

All Articles