can search engine read jquery action

你说的曾经没有我的故事 提交于 2019-12-24 20:10:08

问题


I want to have a popup div with iframe content.

Can search engines read this when I'm using jquery to create it?

Alternatively, is there a way to detect a search engine on the server side and remove the option of this popup?


回答1:


The best way would be to degrade gracefully, e.g. by using a standard

<a id='mylink' href='xyz.html'>

link that points to the resource that is opened in the popup. You would then add the JQuery code to the link, causing it to open in the pop-up.

That way, even users that do not have JavaScript turned on can access your popup.

Most Lightbox clones like Thickbox work that way.




回答2:


Generally speaking, search engines do not execute JavaScript, so there's no way for them to index anything contained in a popup div.

You can, however, inspect User-Agent header to see if the page is requested by web spider, but this is something that's not considered best practice.




回答3:


Search engines do not play well with javascript but you can see how google bot would fetch your page using Google's webmaster tools.

Rendering a different page to bots is not considered a best practice too. The best you can do is graceful degradation.




回答4:


Just to say it at once: DON'T use the iframe, as it is bad-ass technology and search engines won't index the iframe'd page.

First question:

No, it cannot, if the data are loaded simultaneously with the popup "popping up" (as search engines, as said already, generally doesn't execute javascript). If the data are already loaded, and the popup div are somehow hidden at page load, the search engine will index the content.

Second question:

Don't do that. That's called cloaking, and will be punished by search engines if detected - they don't like content customized just for them, and then you're back at scratch.



来源:https://stackoverflow.com/questions/2041888/can-search-engine-read-jquery-action

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!