Hi,
I modified my header with a link that opens another URL. The thing is that the URL varies depending on the environment (prod, test, dev) so I want to set the url dynamically depending on the context.
Simple window.location.hostname does not work. And I had no luck finding any hint in the documentation. Looks like the header script runs in some different context than the browser but I can't figure out how to get to the url value that is in the browser.
So can you advice me on how to get the hostname so that I can collect url that would look like this:
"https://" + someFunctionThatGetsTheHostname + ":8443" ...
My code:
function getTicket() {
var myTicket = "";
var result = remote.call("/custom/ticket");
if (result.status == 200) {
var myTicket = eval('(' + result + ')').ticket;
}
return myTicket;
}
model.jsonModel = {
widgets: [{
id: "DOC_FILTER_PAGE_TITLE",
name: "alfresco/header/SetTitle",
config: {
title: "XY"
}
},
{
id: "DOC_FILTER_HORIZONTAL_WIDGET_LAYOUT",
name: "alfresco/layout/HorizontalWidgets",
config: {
widgetWidth: 100,
widgets: [
{
id: "DOC_FILTER_IFRAME",
name: "alfresco/integration/IFrame",
config: {
src: "https://" + window.location.hostname + ":8443/" + getTicket(),
srcType: "FULL_PATH",
height: "800",
width: "100%"
}
}
]
}
}]
};