AnsweredAssumed Answered

Condition Based on the URL - "window.location.hostname"

Question asked by diegolimabsb on Aug 15, 2016
Latest reply on Aug 19, 2016 by diegolimabsb

Guys!!!

Theres a way to show or hide an element on employee interface based on the url?

I can do some activities with javascript using "window.location.hostname" arg on the analyst form.

On the analyst form i use the code below and it work perfectly:

if (window.location.hostname == "10.0.0.1"){
<PDM_MACRO name=dtlHier hdr="Category" attr=category>
}else{
<PDM_MACRO name=dtlHier hdr="Category 2" attr=category>
}

I need, plus some other things, change the ${ProductName} value on the login.htmpl form based on the url it is accessed, but on the employee htmpl code i cannot use the "window.location.hostname".

I try to use the code below but didint worked!

<PDM_IF window.location.hostname == "10.61.0.54">
<td width="367" height="53" class="login_productname">${ProductName}</td>
<PDM_ELSE>
<td width="367" height="53" class="login_productname">ANOTHER VALUE</td>
</PDM_IF>

I think that the "window.location.hostname" arg is not recognized by the form, or the most probable, im doing something wrong.

I create a variable with the "window.location.hostname" args and call him on a condition with "PDM_IF", but didint worked too!

var zlocation = window.location.hostname;
.
.
.
.
.
<PDM_IF zlocation == "10.61.0.54">
<td width="367" height="53" class="login_productname">${ProductName}</td>
<PDM_ELSE>
<td width="367" height="53" class="login_productname">ANOTHER VALUE</td>
</PDM_IF>

Can anyone help?!

Outcomes