[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Help needed with location.replace

Posted on 2013-05-27
2
Medium Priority
?
219 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 26

Accepted Solution

by:
arober11 earned 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

650 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