All Products 
Username / Customer#
Password
Log In
 Hi,  |  Log Out
  • Site Search
  • Domain Search
  • WHOIS Domain Check
24/7 Support: (480) 505-8877
Hablamos Español
9 AM to 9 PM IST
7 days a week
Go Daddy Support

Search help articles, forums, and discussion groups

need help redirecting my homepage to mobile site

Viewing post 1 to 4 (4 total posts)
Profile picture of drumndbass

drumndbass said 2 years, 1 month ago:

I am looking to have JS code redirect my mobile visitors to a mobile site using User-Agent string.

i found the script but can’t figure out how to put it all together, my main site will be qualitygear.net thru website tonight and i want it to redirect mobile users only to m.qualitygear.net
Could 1 of you competent folks take a look at this script http://www.sebastianoarmelibattana.com/projects/js-redirection and help me put it in 1 peice for insertion into body of my homepage?
Thanks very much.

Profile picture of AdamR

GoDaddy Expert adamr said 2 years, 1 month ago:

@drumndbass

I don’t have any experience with this type of code so hopefully some other community users will be able to provide some input. Are you having trouble determining where to place the code or are you trying to troubleshoot the code itself? As an alternative, you could buy a .mobi domain name and then have the .mobi domain redirect to your mobile page.

“Forwarding or Masking Your Domain Name”

http://support.godaddy.com/help/article/422

-Adam

Profile picture of

Deleted User said 1 year, 7 months ago:

@adamnr
@drumndbass

Here is the script that I have gotten to work in my Website Tonight account.

<script type=”text/javascript”>// <![CDATA[
var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windowssce|palm/i.test(navigator.userAgent.toLowerCase()));
if (mobile) {
document.location = "http://www.yoursite.com/mobile.html";
}
// ]]></script>

replace the document.location = “” to match whatever url you would like website tonight to redirect when accessed by a mobile browser. In website tonight, I would advise making sure there is a copy of your pages built in a mobile page format. This has worked on Iphone and also Android devices thus far.

Follow this guide by godaddy.com to get to the javascript section of website tonight.
https://help.godaddy.com/article/3057?locale=en
Make sure you are pasting the script into the <head> section. This will fix your issue.

Profile picture of Dpowell

dpowell said 9 months, 2 weeks ago:

@ [blank]

I used similar script, but I encountered the problem therein that you could not put a functioning link back to the homepage as the script would simply detect that you are on the mobile browser and send you straight back to the mobile page. That’s called a redirect loop. The fix to this problem is to program it to also make a cookie that it gives you once the code has been executed and detect whether or not you have that cookie, and only to redirect you if you don’t have said cookie. it would look something like this

has-cookie?=fromfull
var mobile=false
give-cookie=fromfull
(not real code)

unfortunately I’m not so good with java so I’m not sure what the actual code should be. Then you find the further problem that people can set their mobile devices to refuse cookies which then causes another redirect loop which leads to another problem…

Add a reply:

You will auto join this group when you reply to this topic.

When posting about a technical issue, please be sure to include as many details as possible, such as your domain name, related URLs and other pertinent information. This consideration will allow us to better understand the situation and quickly assist you.