GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Webmaster Q & Fuckin' A (https://gfy.com/forumdisplay.php?f=27)
-   -   Mobile redirect code (https://gfy.com/showthread.php?t=1078252)

versa 08-16-2012 09:37 PM

Mobile redirect code
 
How would you go about having a mobile visitor go to a page linked from a referring site and display page as normal . If the surfer clicks on any of the site navigation bars/pages etc after this would get redirected if mobile?

Thanks for any thoughts on this!

AdultPayout 08-19-2012 05:29 AM

do you need a code?
Code:

<script type="text/javascript">
if (navigator.userAgent.match(/(opera mini|samsung|ipod|ipad|iphone|up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|psp|treo|nokia|blackberry|pre\/0.1|android)/i)) {
    location.replace("URL for redirect HERE");
}
</script>


Dating Port 09-04-2012 04:19 PM

Oops, wrong answer....edited

You want them to land on your normal page first. Then when they click anything, they get redirected to mobile?
Why not redirect them coming in?

versa 09-07-2012 12:50 AM

One of those image hosting sites. Want them to see the gallery image when they come in through a external link but redirect if they do any actions

Dating Port 09-07-2012 01:47 AM

Put this between your <head> </head> tags

Quote:

<script type="text/javascript">
window.onclick = function() {
setTimeout("window.location.href= 'http://the.redirect.site/'",0);
}
</script>
The "redirect site" being where you want to send them

I just tested it on a page that had an image but no links or urls.

Bonken 09-07-2012 03:14 PM

If you want an alternative, you could use PHP on all the other pages, like this:

Edit: I can't post links, but if you google 'php if mobile device' the google codes reuslt seems optimal.


All times are GMT -7. The time now is 12:52 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc