themilkmaidsupplyco Posted November 20 Share Posted November 20 (edited) Hello! I am looking for a custom code I can inject into my site so that the home page changes depending on your screen size. I was successful in doing this for desktop vs mobile, by making a new version of the homepage with url /mobile. And then I added this code to the desktop homepage header: <script> if (document.documentElement.clientWidth <760) { window.location = "/mobile"; } </script> I am trying to do the same thing now for a tablet version and no code adjustments seem to be working. Does anyone know of a custom code that would allow me to send tablet users to the tablet version of the homepage (/tablet)? Thank you for your help! For reference, my website is https://themilkmaidsupplyco.com/ Edited November 20 by themilkmaidsupplyco added website link Link to comment
tuanphan Posted November 22 Share Posted November 22 Use this <script> if (document.documentElement.clientWidth < 992 && document.documentElement.clientWidth >= 768) { window.location = "/mobile"; } </script> replace /mobile with tablet page Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment