| | #1 |
| Warrior Member Join Date: 2011 Location: Pensacola, FL.
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
|
I created a mobile site for my website, but I can't seem to redirect the domain to show my mobile site on my cellphone instead of the original site? Right now, I have my main site called 'index' and my mobile site called 'app,' and all my mobile site is 1 html file and a css file.
|
| |
| | #2 |
| Advanced Warrior War Room Member Join Date: 2006 Location: USA
Posts: 1,907
Thanks: 237
Thanked 1,377 Times in 676 Posts
|
What kind of redirection script are you using? And what's the URL?
|
| | |
| |
| | #3 |
| Warrior Member Join Date: 2011 Location: Pensacola, FL.
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
|
Not using any, That's what I need to know. I was told you need to add a coding into your index file to check the browser the person is using to see if it needs to redirect the person to the mobile address or keep them on the main site. Question is, what is that coding or if that's even true? Thanks, |
| |
| | #4 |
| Warrior Member Join Date: 2012
Posts: 8
Thanks: 2
Thanked 1 Time in 1 Post
|
Do a search for "mobile redirect script" and you should see code that will be something like ...<script type="text/javascript"> <!-- if (screen.width <= 699) { document.location = "mobile.html"; } It will load your mobile page that you put in for "mobile.html" instead of your index page after determining the screen width. I'm sure someone else here can probably explain this better but that's basically what you need to insert on your index page. |
| |
| | #5 |
| Advanced Warrior War Room Member Join Date: 2006 Location: USA
Posts: 1,907
Thanks: 237
Thanked 1,377 Times in 676 Posts
|
Yeah, you need a script that redirects the users based on either A) their device screen width, or B) the "user agent" (which is a device-specific redirection). This is usually done in Javascript or PHP, but can also be done via htacess. The simplest way is to use a Javascript redirection based on screen width. For example... Code: <script type = "text/javascript">
<!--
if (screen.width < 1024)
{document.location = "mobile_site.html";}
-->
</script> So if you need "perfect", then you'll need to go with "user agent" based redirection, which can be a pain if you do it yourself (because you have to keep updating it whenever new mobile devices come out). But there's tons of pre-existing scripts and services out there specifically for this. Just Google "mobile redirection script". |
| | |
| |
| | #6 |
| Web Developer War Room Member Join Date: 2012 Location: Vancouver, BC
Posts: 593
Thanks: 149
Thanked 162 Times in 133 Posts
| |
| |
| |
| | #7 |
| brickandmobile.com War Room Member Join Date: 2010 Location: Toronto
Posts: 309
Thanks: 60
Thanked 106 Times in 64 Posts
|
There are some great Mobile Redirect scripts you can find. If you are using Wordpress there are a number of plugins you can use that will accomplish that you are trying to do.
|
| [ | |
| |
| | #8 |
| Digital Marketer War Room Member Join Date: 2010 Location: Australia
Posts: 12,472
Thanks: 1,984
Thanked 8,187 Times in 4,079 Posts
|
Yes it's true you need a redirect script in place otherwise it will not work. As others have mentioned above there are several options for you when choosing a mobile redirect script. You can use screen size detection or user agent detection. Screen size detection basically looks at the width of the screen viewing your website and if it's below a certain width (ie - a mobile device) that person will be redirected to the mobile website you specify. User agent detection looks for the type of device and/or mobile browser viewing the website. When they detect a mobile device or mobile browser the user will automatically be sent to the mobile website you specify. Each option has it's own advantages and disadvantages. Screen width detection is what I have always used up until now and it's always worked quite well. The only problem with screen width detection is that some newer devices have screen resolutions the same size as desktop PC's so they will not be picked up by the redirect script. The disadvantage with user agent detection is that you must specify each and every user agent meaning everytime a new mobile device or mobile browser is released, you need to update your redirect code accordingly. So it's not really set and forget. If I were you I would just start out with the simple screen width detection script posted in post#5 above. Copy and paste that right into your main websites homepage anywhere above the closing head tag </head>. Make sure to specify the address of your mobile website in that script. The only other thing I would do is change the 1024 value to 1023. There are still a LOT of dekstop PC's that have a screen width of 1024 pixels so if you leave it at that value a lot of your desktop computer viewers will end up being redirected to your mobile site which is not what you want. |
| | |
| |
| The Following User Says Thank You to WillR For This Useful Post: |
|
| Bookmarks |
| Tags |
| main, mobile, phone, redirect, redirecting, site, web |
| |