Solved

Help needed with location.replace

Posted on 2013-05-27
2
204 Views
Last Modified: 2013-05-28
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("https://secure.mauitradewinds.com/TransMan/resform-mobile.htm")');}
</script>

The page which is supposed to perform the location.replace is http://mauitradewinds.com/Test/resform-redirect-test.htm  Please advise.
0
Comment
Question by:ddantes
2 Comments
 
LVL 26

Accepted Solution

by:
arober11 earned 500 total points
ID: 39200083
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 = "https://secure.mauitradewinds.com/TransMan/resform-mobile.htm";
}

Open in new window

0
 

Author Closing Comment

by:ddantes
ID: 39200443
Thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now