更改ajax以请求用要嵌入到html页面本身的html内容填充div

发布于 2024-10-08 14:09:11 字数 375 浏览 0 评论 0原文

我在将 ajax html 嵌入到 html 页面本身时遇到问题,我需要使此 ajax 响应在页面源中显而易见。

我有 2 台服务器,一台运行 Web 应用程序,另一台负责执行搜索查询(搜索器)。现在应用服务器将html页面发送到客户端的浏览器,浏览器会通过ajax向搜索者请求一些搜索查询,成功回复后浏览器会将html结果放入页面中。

问题是搜索结果不存在于 html 源中,这对 SEO 不利,谷歌爬虫将不知道正在搜索什么。

另一个问题是,如果我让应用程序服务器发出请求并等待搜索结果,则页面将花费大量时间来加载。

我不知道该怎么办..我真的需要使网站 SEO 友好,并且还需要页面快速加载!

任何指示或想法将不胜感激。

多谢, 瓦埃尔

I am having a trouble embedding ajax html into the html page itself, I need to make this ajax response be apparent in the page source.

I have 2 servers, one that runs the web application and the other is responsible for performing search queries (searcher). Now the application server sends the html page to the client's browser, which will request some search queries to searcher through ajax, after the successful reply the browser will put the html result into the page.

The problem is that search results do not exist in the html source which is not good for SEO, google crawlers will have no idea what is being searched for.

The other problem is if I made the application server make a request and wait for searcher results, the page will take tons of seconds to load.

I am not sure what to do.. I really need to make the website SEO friendly and also need the page to load quickly!!

Any pointers or ideas will be appreciated.

Thanks a lot,
Wa'el

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧话新听 2024-10-15 14:09:11

在这种情况下,不可能让 Ajax 提供的数据出现在“源”中,因为源始终是在任何客户端更改之前从服务器请求的原始页面。

任何不支持 javascipt 的客户端(例如搜索引擎爬虫)都永远不会看到任何 ajax 加载的数据。

如果您需要可索引的信息,您需要
1:从服务器提供页面,没有客户端加载
2:不使用发布的表单来获取数据,搜索引擎不跟踪帖子,只获取链接。

It's impossible to get Ajax provided data to be present in the "source" in this case as the source is always the original page requested from the server before any client side changes.

And any kind of client that does NOT support javascipt, like search engine crawlers, will never se any ajax loaded data.

If you need the information to be indexable you need to
1: serve the page as in from the server, no client side loading
2: Not use posted forms fo reach the data, search engines do not folow posts, only get links.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文