如何使用 ajax 加载你的融合页面,这样慢速宏不会减慢页面加载速度
一些使用宏的页面,例如:
topusers 或popularlabels,
加载速度确实很慢。有没有办法通过ajax异步加载,而不是阻止初始页面加载?
some pages that use macros like:
topusers or popularlabels
are really slow to load. Is there any way to have this load asynchronously through ajax instead of having this block the initial page load ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Future 宏绝对是 100% 最好的方法。
我们在 Confluence 2.10.3 实例上大量使用它来加速一切,但我还没有使用更新的版本对其进行测试。
https://labs.atlassian.com/wiki/display/FUTURE/Home
我制作了一个小视频来展示它的工作原理 - 访问 SharePoint 服务器来呈现文档列表。这不是一个完美的演示,但可以让您了解它的作用。
我也制作了一个视频,但还没有 StackOverFlow 代表将其发布到这里,所以这里是 URL 的一部分
screencast.com/t/tz8xdSCQYxp
布伦丹
The Future macro is absolutely 100% the best way to do this.
We use it massively on a Confluence 2.10.3 instance to speed up everything, but I haven't tested it with more recent versions.
https://labs.atlassian.com/wiki/display/FUTURE/Home
I made a little video showing it working - reaching out to a SharePoint server to render a document list. This is not a perfect demo but gives you an idea of what it does.
I made a video of this too, but don't have the StackOverFlow rep to post it here yet so here is part of the URL
screencast.com/t/tz8xdSCQYxp
Brendan
如果您考虑使用 jQuery 库,它内置了对异步 ajax 请求的支持。
If you consider using jQuery library, it has build-in support for asynchronous ajax requests.
也许谷歌分析方法会对你有所帮助。
但是,我不知道依赖项如何工作:)
Maybe google analytics approach will help you.
However, I don't know how will work for dependencies :)
实际上,您所需要做的就是推迟加载,直到页面加载完成。为此,您可以创建一个 javascript 函数来设置您正在加载的内容的脚本标记,然后当正文加载完成时,调用此函数。您可以通过以下方式做到这一点:
This code will wait until the page is fully loaded and then call the function to load your ads.
Really all you need to do is postpone the loading until after the page has loaded. To do that, you can make a javascript function that sets the script tags of what you are loading and then when the body is done loading, call this function. You can do that by:
This code will wait until the page is fully loaded and then call the function to load your ads.