?
Solved

How tell if the current site visitor is really the Google indexing bot?

Posted on 2014-02-27
6
Medium Priority
?
222 Views
Last Modified: 2014-10-25
Using javascript, is there a way to detect if the currect site visitor is the Google indexing bot?

If it's Google, then we will make sure that embedded video is delivered using the Html5 "video" tag, or the ancient "object" tag . . . but *not* an iframe tag.

If it's not Google, we'll display video according to whatever is best for the given device, platform, and video file type.  That could result in use of 'iframe' or other things that Google doesn't like.

Obviously we'll have a video map file as well.

Thanks
0
Comment
Question by:stgreenwalt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 58

Assisted Solution

by:Gary
Gary earned 500 total points
ID: 39893660
You can try something like

if( navigator.userAgent.toLowerCase().indexOf('googlebot') > 0){
// Googlebot
}
0
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39893721
Google also does not like it when you put up special content for them that is different than what you server to other users.  https://support.google.com/webmasters/answer/66355
0
 
LVL 53

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 500 total points
ID: 39893726
display video according to whatever is best for the given device,

That is all you need to worry about.    That google is smarter than you think. It is already out gaming your game.
0
 
LVL 10

Assisted Solution

by:Jeffrey Dake
Jeffrey Dake earned 500 total points
ID: 39897680
To make sure you are serving google what they want the best way is to check the user agent, like Cathal stated.  Since the html is the same as you would be showing other users that are using devices that support the "video" tag then you are not really showing different content to google.  If you really need to verify that it is google you can always double check the ip addresses to see if they resolve to a known google bot ip address, but since all you are doing is switching the video tag vs an iframe, checking the user agent would probably be the best.  

Firefox has a plugin for User-Agent switcher so you can test the user agent coming in as googlebot.
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question