FAQFAQ   ПоискПоиск   ПользователиПользователи   ГруппыГруппы   РегистрацияРегистрация 
 ПрофильПрофиль   Войти и проверить личные сообщенияВойти и проверить личные сообщения   ВходВход 

Match full site not mobile

 
Начать новую тему   Ответить на тему    Список форумов Rolandus.org -> SOS!
Предыдущая тема :: Следующая тема  
Автор Сообщение
Михаель



Зарегистрирован: 22.05.2026
Сообщения: 5846

СообщениеДобавлено: Вс Ноя 15, 2026 3:14 am    Заголовок сообщения: Match full site not mobile Ответить с цитатой

Hello, Guest!

Article about match full site not mobile:
Explore all Collectives STACK INTERNAL Turn scattered docs and code into trusted AI context. Explore the new Stack Internal platform. Create a workspace View full website, not mobile version on iPhone Ask Question Asked 15 years, 11 months ago Modified 14 years, 9 months ago Viewed 9k times 5 I have a script that detects whether you're an iPhone user or not and redirects to a more iPhone friendly page.

>>> GO TO SITE <<<


Copy <script type="text/javascript"> if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) { location.replace("http://domain.com/iphone/"); } </script> This works great but has one problem. It is convention to offer the user the ability to view the full web page. However, if I link to the root, obviously the redirect is going to send them to the mobile version! Any ideas on how to include if click on the link from /iphone/, they can go to / and stay there. javascriptiphonehttp-redirectmobile-website Share Improve this question Follow edited Jan 16, 2012 at 1:38 ThinkingStiff 65.5k32 32 gold badges 150 150 silver badges 241 241 bronze badges asked Nov 15, 2010 at 4:43 Rya 3212 2 gold badges 8 8 silver badges 13 13 bronze badges Add a comment 2 Answers Sorted by: Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 8 When the user arrives, determine their browser type - mobile or full - and set a cookie with this value. Use this cookie value to decide what version of the site to display. AS you mention, offer a link to the "full" site to the mobile users, but if they click it, run a quick script to update the cookie to the "full" value and then redirect them to the full site. Their cookie is now set for the full site, so they won't get bounced back to the mobile site. Now, if cookie are a problem, you could use something like PHP to set a session values to maintain the full/mobile status of the session, but that's probably getting beyond the scope of the original question. Share Improve this answer Follow edited Nov 15, 2010 at 4:57 answered Nov 15, 2010 at 4:49 Surreal Dreams 26.5k4 4 gold badges 50 50 silver badges 61 61 bronze badges 4 Comments Add a comment Niet the Dark Absol Nov 15, 2010 at 4:51 You can do this without the intermediate script, by having a query string like "?i-want-to-use-the-main-site=1" (obviously less complex than that XD), setting a cookie if that query string is there, and redirecting if neither the cookie or the query string are present. 0 Reply Joel Nov 15, 2010 at 4:52 and if they have cookies turned off you can just set it in the query string: ?preventMobileRedirect=true or something 0 Reply Surreal Dreams Nov 15, 2010 at 4:53 @Kolink: This is true. I was thinking in PHP, not JavaScript, but it works either way. I'll amend the answer though, that's more in the spirit of the original question. 0 Reply Surreal Dreams Nov 15, 2010 at 4:55 @Joel: If users have cookies turned off, then you could fall back on a session value if you have some server side scripting to resort to. 0 Reply Add a comment 0 The Query String is the way to go ( as the others have said above). Looking at Facebook, if you click on the 'full site' link on the mobile site, it redirects to www.facebook.com/login.php?m2w - the m2w is probably MobileToWeb and this will prevent the site redirecting the user to the mobile site.













match full site not mobile


match com full site not mobile


match full site not mobile


match com full site not mobile
Вернуться к началу
Посмотреть профиль Отправить личное сообщение
Показать сообщения:   
Начать новую тему   Ответить на тему    Список форумов Rolandus.org -> SOS! Часовой пояс: GMT + 4
Страница 1 из 1

 
Перейти:  
Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете голосовать в опросах


Powered by phpBB © 2001, 2005 phpBB Group

Яндекс цитирования