Forum Moderators: martinibuster
I use DIVs and a style sheet for the layout of my pages. I use 3 absolutely positioned DIVs. The top horizontal DIV contains an Adsense leaderboard.
In Google's cache the two DIVs that usually sit below the leaderbord DIV are now covering it! The absolute positioning is broken because of the header that Google displays on all cached pages.
The HTML and CSS I wrote is completely W3C compliant, yet I think it's against their TOS that Adsense ads are covered in Google's cache. What's your opinion on this? Any suggestions as to how I would uncover the Adsense ads?
I have implemented a possible solution, but I'll need to do some more testing to be sure.
I wonder if I should inform Google. I am not to eager to contact Google, because I am actually violating their TOS. On the other hand, my pages are W3C compliant, and the issue is actually caused by the way Google cached pages are displayed.
Anyway. The next cache run will eliminate the problem since I moved the ads to the bottom of the page, just to be sure.
You really don't have control over how Google shows your page in it's cache so I don't think you should be worried at all about TOS violations.
In acutality Google is infringing upon your Copyright, but I'm sure you probably implicitly approve of Google's cache. You could always disable Google's caching of your site using robots.txt or the meta tag NO cache. Of course Google could implement the YES cache option and get rid of their Copyright problem. I'm sure that might upset some Webmasters too.
PHP Example:
<?
if (str_pos('search?q=cache:', $_SERVER['HTTP_REFERER'])){
$stylesheet = 'no_abs_positioning.css';
} else {
$stylesheet = 'abs_positioning.css';
}
?>
<head>
<link type="text/css" rel="stylesheet" href="<?=$stylesheet?>">
I don't think that would work. The page is at Google's side. When a user requests a cached page no request is made to the actual page on my site. The page is stored at Google.
Thanks anyway for posting. I think I have come up with a solution. I noticed the top part containing the Adsense code is actually not a DIV. I have changed this into a div and added a high Z-Index to it. I'll let you know how it works out.
if (stristr($_SERVER['HTTP_USER_AGENT'], "Googlebot"))
{
//use other stylesheet
}
else
{
//use default stylesheet
} So the bot will be use the better stylesheet and he will show this style in his cache too.
I don't know if this is already cloaking. But I think it should be no problem if the content stays the same. (I know - this discussion belongs into another forum).
Yes, in a way, you are correct. On the other hand, it can still be done like I noted above.
Google doesn't cache the stylesheet, it gets pulled from your server, even on cache views.
However, you would have to force the server to parse .css files for PHP, to do it that way. I don't like that idea at all.
Fortunately, there is a better way....mod_rewrite!
RewriteEngine on
RewriteCond %{REQUEST_URI} ^normalstyle.css$
RewriteCond %{HTTP_REFERER} search?q=cache
RewriteRule ^$ /googlecachestyle.cssv [L]
Keep in mind that I just wrote this code off the top of my head and it may have an error :)
Thanks Taps, for yet another solution!