javascript - If it possible with jQuery onLoad function to load specific page? -
i have been wondering if possible, instead of building responsive website. build 2 different websites, 1 phones (only small screens) , other tablets , desktops.
now in mobile version of website exclude large files , videos , on.
i wondering possible?
$(document).onload(function(){ if(screen){ \\ load mobile.html }else{ \\ load desktop.html } });
or maybe if there better way, interested in excluding elements dom on mobile devices instead of hiding them css.
thanks
you can change document location. more location object here.
i wouldn't wait document load in code, instead run straight away.
if (window.matchmedia("(min-width: 600px)").matches) { document.location.pathname = "desktop.html"; } else { document.location.pathname = "mobile.html"; }
Comments
Post a Comment