It's all about the answers!

Ask a question

Creating opensocial gadgets


Krzysztof Daniel (5163) | asked Mar 22 '11, 8:41 a.m.
Hello

I have created an opensocial gadget which should refer to the fronting app for data/services.
It works fine if I hardcode the path - but is there a way to avoid this?
I do not want to have all my widgets with paths like:
https://localhost:9444/myapp/myservice :(

One answer



permanent link
Randy Hudson (216243) | answered Mar 22 '11, 1:54 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
If your gadget is using an AjaxModule, we write the base tag into the html, so you can use:

	var baseURI = document.baseURI;

if (!baseURI) {
var baseTags = document.getElementsByTagName('base');
baseURI = (baseTags && baseTags[0].href) || document.location.href;
}

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.