English 中文(简体)
how to ajax your confluence pages so slow macros dont slow down page load
原标题:

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 ?

最佳回答

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

问题回答

If you consider using jQuery library, it has build-in support for asynchronous ajax requests.

Maybe google analytics approach will help you.

(function() {
    var delayed = document.createElement( script );
        delayed.type =  text/javascript ;
        delayed.async = true;
      delayed.src =  URL_AD_SERVER ;
        (document.getElementsByTagName( head )[0] || document.getElementsByTagName( body )[0]).appendChild(delayed);
})();

However, I don t know how will work for dependencies :)

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:

function loadConfluence() {
 var ads = document.createElement( script );
 ads.async = true;
 ads.src =  your_ad_url ;
 return document.getElementsByTagName( body )[0].appendChild(ads);
};
window.onload = loadConfluence();
This code will wait until the page is fully loaded and then call the function to load your ads.




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签