How to get the Jira Base URL from Javascript in a reliable way?

Hi,

AJS.params.baseURL returns undefined (Jira 7.6.1)

Is there any way to get the Jira base url from Javascript. I mean a way that really works,

Thanks in advance,
Pablo.

You can always use AJS.contextPath() to get the context path - then you can combine that with the various window.location objects.

I used it before, but URL must be absolute in gadgets, otherwise, they do not work from other products.

I.e: A Jira gadget added to a Confluence page…