We recommend reviewing what is submitted before posting, in case your idea has already been submitted by another community member. If it has been submitted, vote for that existing feature request (by clicking the up arrow) to increase its opportunity of being added to Cireson solutions.
For more information around feature requests in the Cireson Community click here.
session.user.Analyst
We use Portal version7.0.12 and I try to use different custom.css for end-user and analyst. In the custom.js I have the following code:
I always get the error message, that session is undefined. Could anyone help please?
Kind Regards
Margret
Best Answers
-
merlenette_jones Member Advanced IT Monkey ✭✭✭Margarete_Jussen said:Hi,
We use Portal version7.0.12 and I try to use different custom.css for end-user and analyst. In the custom.js I have the following code:if (!session.user.Analyst){loadCSS = function(href){ var cssLink = $("");$("head").append(cssLink);cssLink.attr({ rel: "stylesheet", type: "text/css", href: href });};loadCSS("/CustomSpace/enduserCustom.css");}
I always get the error message, that session is undefined. Could anyone help please?
Kind Regards
Margret
Your code looks good. I think what is happening is that the js code is loading before the session can be defined. What I would do is wrap your code in document.ready so the session can be defined before your js loads.
Does that make sense?
Merle5 -
merlenette_jones Member Advanced IT Monkey ✭✭✭Also I believe you posted this in the wrong section as this is for feature request5
-
Martin_Blomgren Customer Ninja IT Monkey ✭✭✭✭
<div>$(document).ready(function (){<br id="null"> if(!session.user.Analyst){ <br> $('head').append('<link href="/CustomSpace/enduserCustom.css" rel="stylesheet" type="text/css">'); <br> }<br>}</div>
6
Answers
We use Portal Version 7.1.2012.1
Your code looks good. I think what is happening is that the js code is loading before the session can be defined. What I would do is wrap your code in document.ready so the session can be defined before your js loads.
Does that make sense?
Merle
your hint helped. The session variable ist now defined but the alternate custom.css ist not loaded. Maybe you have any idea.
Regards
Margret
Try the following inside custom.js:
thanks for your help. Ich changed the code to the shorter version. The reason for not loading the enduserCustom was a different statement which has already been in my custom.js.
Best regards
Margret