It's all about the answers!

Ask a question

Creating opensocial gadgets

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

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 (216143) | answered Mar 22 '11, 1:54 p.m.
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.