I have a website which requires javascript enabled to be functioning properly.
So this made me put a <noscript>
tag right after the <body
>开发者_如何学JAVA tag inside a DIV:
<noscript><div align="center" style="border:solid; margin:5px; padding:5px; font-weight:bold; background-color:#F00;" width="800px">You don't have javascript enabled. Please enable it to use this site.</div></noscript>
The problem is, that this is the first text (and almost only) after the body tag.
This makes search engines display the text inside the <noscript>
tag in the SERP, which is bad.
My Q is, how can I solve this? Could I put a hidden DIV BEFORE the noscript and thus make the Search Engines display that text instead?
Thanks
You could put it on the bottom and position it absolute on the top using CSS? Not the cleanest way, but then again.. having a website that doesn't work without JavaScript isn't either.. ;)
Consider a text which would be appropriate for both users and bots, like
FooBars is a site which tries to grub every foo with a blinking bar. To best serve our customers, blah blah, you need to have javascript enabled.
Most search engines do not like to be tricked, and a hidden DIV would definitely count as a trick. Depending on whether Google detects it, they can lower your rank.
You can wrap this text in an image. This is the best way in my opinion.
Don't use hidden DIVs to steer what search engines show. You never know, there may be penalties.
Consider placing the noscript
tag at the bottom of the page, and using
position: fixed; left: 0px; top: 0px; right: 0px;
(Doesn't work in IE6) or
position: absolute; left: 0px; top: 0px; right: 0px;
to place it at the top of the screen.
Why don't you do this: Create a static version of your site. Or at least a non-javascript version with text you want the SE to see. Then, when the page is loaded, replace that via Javascript with the actual contents.
Also, use <meta name="description"/>
to change what search engines include inside the result detail by default.
Why not include the text you want to be displayed in the search result in the div within the noscript tag? Even if JavaScript is deactivated this would be more user friendly. Describe, what the site is about and then in the last sentence idnicate, that this site only works with JavaScript enabled (and maybe apologize for that ;-)
精彩评论