| | #1 |
| Active Warrior Join Date: 2008 Location: , , United Kingdom.
Posts: 84
Thanks: 3
Thanked 12 Times in 9 Posts
|
Hi Everyone I have created a mobile friendly site for myself and want to redirect visitors if they find it with a resolution of more than 600 pixels to my main site. The script I'm using is this: <script language="javascript"> var width = screen.width; if (width >=600) {window.location=' http://mysite.com/'} </script> I have placed this code between the <head> and </head> tags but the screen if anything refreshes but does not redirect. Hope you get the gist and can help Thanks Chris |
|
Get your affiliate marketing business off to a good start, visit Secret Affiliate Cash and pick up your Free Affiliate Marketing Report.
| |
| |
| | #2 |
| The Grand Master Join Date: 2011
Posts: 39
Thanks: 1
Thanked 4 Times in 4 Posts
|
Some mobile phones are not compatible with java script, try it on some other mobile phones and see the effect.
|
| | |
| |
| | #3 |
| Active Warrior Join Date: 2008 Location: , , United Kingdom.
Posts: 84
Thanks: 3
Thanked 12 Times in 9 Posts
|
Hi pc101seo This issue is if some one found my mobile site via conducting a search from their desktop. If this occurs it should direct them to my main site. If some one finds my mobile site through their mobile the site is coded to be optimized for mobile viewing with all the top mobile variants on the market today! Chris |
|
Get your affiliate marketing business off to a good start, visit Secret Affiliate Cash and pick up your Free Affiliate Marketing Report.
| |
| |
| | #4 |
| New Warrior Member War Room Member Join Date: 2005 Location: Kansas City, USA
Posts: 21
Thanks: 2
Thanked 2 Times in 2 Posts
|
Chris The line break in the window.location redirect does cause a JS error. Be sure that the command is all on one line. if (width >=600) {window.location='http://mysite.com/'} If that does not fix your problem, it is possible that there is another Javascript error somewhere else on the page. It may not even be related to particular script. Open up your browser error console and look for errors. I recommend using Firefox for your Javascript code testing. To open the error console in FF use the following menu option: Tools->Error Console -Clint |
| |
| | #5 | |
| Active Warrior Join Date: 2008 Location: , , United Kingdom.
Posts: 84
Thanks: 3
Thanked 12 Times in 9 Posts
|
It works fantastic!! Many Thanks Chris | |
| |
|
| Bookmarks |
| Tags |
| javascript, problems, redirect |
| Thread Tools | Search this Thread |
| |