Page 1 of 1

Wurfl.js Redirecting Googlebot

Posted: Wed May 18, 2016 12:21 am
by whynot
We are currently using wurfl.js on two of our sites to redirect our mobile visitors to our mobile subdomain however both sites have now been deindexed by Google. We attempted to spoof the user agent using a browser plugin and noticed that wurfl is redirecting Googlebot crawler to our mobile domain. We don't want this behavior as the majority of our content is on the desktop site.

How can we fix this?

Re: Wurfl.js Redirecting Googlebot

Posted: Wed May 18, 2016 9:33 am
by aaronp
Hi James,

Thank you for letting us know. Are you able to provide a sample of the User Agent string that is being spoofed?

Aaron

Re: Wurfl.js Redirecting Googlebot

Posted: Wed May 18, 2016 2:40 pm
by whynot

Re: Wurfl.js Redirecting Googlebot

Posted: Thu May 19, 2016 9:42 am
by aaronp
Hi James,

After testing the provided User Agent string, It returns `false` for `is_mobile` and `true` for `is_robot`.

Are you able to let me know what capabilities/logic you are using to redirect to desktop/mobile sites?

Thanks,

Aaron

Re: Wurfl.js Redirecting Googlebot

Posted: Thu May 19, 2016 6:37 pm
by whynot
Thanks for getting back to me Aaron. We've solved the Googlebot issue by using the code below however now all bots including the mobile bots of major search engines are being directed to the desktop version of our site. We want to be able to send the mobile crawlers from search engines to the mobile version of our site. Without this feature, the crawlers will not be able to see the mobile version of our sites and will penalize the site for not being mobile friendly.

<script type='text/javascript' src="//wurfl.io/wurfl.js"></script>
<script type="text/javascript">
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) {
var c = ca;
while (c.charAt(0)==' ') c = c.substring(1);
if (c.indexOf(name) != -1) return c.substring(name.length,c.length);
}
return 0;
}
var cookie = getCookie('redirecToDesktop');
if (cookie == 0) {
if (WURFL.form_factor != 'Desktop' && WURFL.form_factor != 'Tablet'
&& WURFL.form_factor != 'Robot') {
var href = window.location.href;
//href = href.replace('m.domain.com');
href = href.replace('//', '//m.');
window.location.href = href;
}
}
</script>

See the following link for a list of all of Google's UAs

https://support.google.com/webmasters/a ... 1943?hl=en