Display the No Javascript section, but not for google / facebook share service

I would like to show a div near the top of the site to offer visitors who do not have javascript so that they can enable their javascript. I thought I found a good method using the noscript tag.

Unfortunately, I found that this solution was less than ideal due to services such as Google indexer and the Facebook link exchange feature. These services clear the page and read the text in the noscript div as a summary of the page. This is because these services do not use javascript (obviously).

So, my question is to the masses: what methods do you prefer to avoid the message "please include your javascript" in Google results, etc.

Ideally, I hope to find best practice to solve this problem, but I am interested in hearing any methods that you have from the user, or failed in the past.

Thank!

+3
source share
1 answer

In a pure HTML script (with tags), consider placing your message at the bottom of the page and using CSS so that it appears noticeably at the top. This should bring your warning far enough down the page to avoid it appearing in typical search results.

If your HTML is generated by a script server, you can conditionally present an element based on the UserAgent client. A good list of search engine agents would be convenient in this case.

+1
source

Source: https://habr.com/ru/post/1757667/


All Articles