Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Screen resolution detect and redirect to URL w/ manual switch back Reply To: Screen resolution detect and redirect to URL w/ manual switch back

#148443
toma888
Participant

downcasteyes,

I’m using a basic HTML site and need the code for a mobile redirect as well as let the user click on a link
to view full site.
I’m currently using this code:

if (document.location.search.indexOf(“skipmobile”) >= 0) {
document.cookie = “skipmobile=1”;
}
else if ((document.location.hostname.match(/.mobi$/) || screen.width < 699)
&& document.cookie.indexOf("skipmobile") == -1)
{
document.location = "http://dacopywriter.com/mobile-3/index.html&quot;;
}

and it works fine but will not validate in W3C:
(required attribute “type” not specified )

Do you have some clean code that I can just drop into the ?