mobile redirect script not working for client's site

5 replies
I had someone make mobile sites for clients, but one of them is not redirecting. The rest of them are. I used the same code for all of them. Its a regular javascript code based on screen width:
<script type="text/javascript">
if(window.location.hash != '#r=off') {
if (screen.width <= 1023) {
document.location = "http://m.mysite.com";
}
}
</script>

If I go to the mobile site directly (i.e. I type in m.mysite.com) into the url, the mobile site works fine. Its not the script because I am using the script for other sites.

The guy I hired to make them stopped replying to me, so I am not sure what is wrong.

I don't know too much about coding but have edited code before so can follow instructions.

It's just weird that the problem is only with this site.
#client #mobile #redirect #script #site #working
  • Profile picture of the author PaidAllDay
    Mobile redirects really should be done through .htaccess not javascript. Especially given that not all mobile browsers support javascript. Take a look at something like this:

    NingNing Wang: How to redirect to mobile site using htaccess
    {{ DiscussionBoard.errors[8513165].message }}
  • Profile picture of the author stranger11
    Thanks. I don't do much coding, so I cannot find the htaccess file. Where can I find the .htaccess file? I only see the index and the different pages in the root directory.
    {{ DiscussionBoard.errors[8524700].message }}
  • Profile picture of the author stranger11
    I found out how to edit the .htaccess file, but it's still not redirecting. Any ideas?
    {{ DiscussionBoard.errors[8524723].message }}
  • Profile picture of the author Adrian John
    PM the website details and I'll set you up if you want or I will give you instructions.
    Signature
    ARE YOU A CONSULTANT? Do you have clients who could use MORE LEADS?
    Get them a MOBILE WEBSITE PLATFORM built to stay up with their clients habits.
    More than 50% of their customers buys from their mobile devices now!

    CLICK HERE FOR MORE INFO
    {{ DiscussionBoard.errors[8525177].message }}
  • Profile picture of the author stranger11
    Thanks Adrian,

    For the record, I PMd Adrian the details, and now its fixed. See the timing of the posts yourself. He actually fixed it over 5 hours ago.
    {{ DiscussionBoard.errors[8534387].message }}

Trending Topics