Help needed with location.replace

I'm trying to direct a visitor's browser to a page called resform-mobile.htm, if the visitor's device is mobile.  My code isn't working -- the wrong page is loaded.

<script type="text/javascript">
if(TestforTouchScreen() )
{document.write ('location.replace("")');}

The page which is supposed to perform the location.replace is  Please advise.
Who is Participating?
arober11Connect With a Mentor Commented:
Start by temporarilt sticking an : alert("Mobile device");  at the start of the location replace block, and see if TestforTouchScreen() is firing correctly.

Also worth a try:

    alert("Mobile device"); 
    window.location = "";

Open in new window

ddantesAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.