Get user theme directly in lightning component
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
1
down vote
favorite
In lightning, is there a way / global event that we can directly get user ui themeDisplayed without calling an apex method.
lightning-components
add a comment |Â
up vote
1
down vote
favorite
In lightning, is there a way / global event that we can directly get user ui themeDisplayed without calling an apex method.
lightning-components
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
In lightning, is there a way / global event that we can directly get user ui themeDisplayed without calling an apex method.
lightning-components
In lightning, is there a way / global event that we can directly get user ui themeDisplayed without calling an apex method.
lightning-components
lightning-components
edited 34 mins ago
Robs
1,110424
1,110424
asked 2 hours ago
Pino Cao
61
61
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
As of today (and as far as I know of), there's no direct way of getting the UI Theme in a Lightning Component without implementing a server side controller.
The Salesforce Developers Blog on the topic Introducing UI Theme Detection for Lightning Experience mentions this, excerpt below:
You canâÂÂt determine the userâÂÂs UI theme directly within a Lightning Component because it only has access to a limited set of global values. You must implement an Apex server-side controller to provide this information.
add a comment |Â
up vote
1
down vote
I wouldn't recommend it, but you could look through the DOM for the data-aura-rendered-by property.
document.querySelectorAll('[data-aura-rendered-by]');
If you find it, you're in Lightning Experience.
There's no guarantee this won't change, so...be ready for your code to break!
I would always use an Apex controller instead, caching the response to lighten the load.
String theme = UserInfo.getUiThemeDisplayed();
More info, including working sample code here:
https://developer.salesforce.com/blogs/isv/2016/04/introducing-ui-theme-detection-for-lightning-experience.html
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
As of today (and as far as I know of), there's no direct way of getting the UI Theme in a Lightning Component without implementing a server side controller.
The Salesforce Developers Blog on the topic Introducing UI Theme Detection for Lightning Experience mentions this, excerpt below:
You canâÂÂt determine the userâÂÂs UI theme directly within a Lightning Component because it only has access to a limited set of global values. You must implement an Apex server-side controller to provide this information.
add a comment |Â
up vote
3
down vote
As of today (and as far as I know of), there's no direct way of getting the UI Theme in a Lightning Component without implementing a server side controller.
The Salesforce Developers Blog on the topic Introducing UI Theme Detection for Lightning Experience mentions this, excerpt below:
You canâÂÂt determine the userâÂÂs UI theme directly within a Lightning Component because it only has access to a limited set of global values. You must implement an Apex server-side controller to provide this information.
add a comment |Â
up vote
3
down vote
up vote
3
down vote
As of today (and as far as I know of), there's no direct way of getting the UI Theme in a Lightning Component without implementing a server side controller.
The Salesforce Developers Blog on the topic Introducing UI Theme Detection for Lightning Experience mentions this, excerpt below:
You canâÂÂt determine the userâÂÂs UI theme directly within a Lightning Component because it only has access to a limited set of global values. You must implement an Apex server-side controller to provide this information.
As of today (and as far as I know of), there's no direct way of getting the UI Theme in a Lightning Component without implementing a server side controller.
The Salesforce Developers Blog on the topic Introducing UI Theme Detection for Lightning Experience mentions this, excerpt below:
You canâÂÂt determine the userâÂÂs UI theme directly within a Lightning Component because it only has access to a limited set of global values. You must implement an Apex server-side controller to provide this information.
answered 1 hour ago
Jayant Das
6,9352320
6,9352320
add a comment |Â
add a comment |Â
up vote
1
down vote
I wouldn't recommend it, but you could look through the DOM for the data-aura-rendered-by property.
document.querySelectorAll('[data-aura-rendered-by]');
If you find it, you're in Lightning Experience.
There's no guarantee this won't change, so...be ready for your code to break!
I would always use an Apex controller instead, caching the response to lighten the load.
String theme = UserInfo.getUiThemeDisplayed();
More info, including working sample code here:
https://developer.salesforce.com/blogs/isv/2016/04/introducing-ui-theme-detection-for-lightning-experience.html
add a comment |Â
up vote
1
down vote
I wouldn't recommend it, but you could look through the DOM for the data-aura-rendered-by property.
document.querySelectorAll('[data-aura-rendered-by]');
If you find it, you're in Lightning Experience.
There's no guarantee this won't change, so...be ready for your code to break!
I would always use an Apex controller instead, caching the response to lighten the load.
String theme = UserInfo.getUiThemeDisplayed();
More info, including working sample code here:
https://developer.salesforce.com/blogs/isv/2016/04/introducing-ui-theme-detection-for-lightning-experience.html
add a comment |Â
up vote
1
down vote
up vote
1
down vote
I wouldn't recommend it, but you could look through the DOM for the data-aura-rendered-by property.
document.querySelectorAll('[data-aura-rendered-by]');
If you find it, you're in Lightning Experience.
There's no guarantee this won't change, so...be ready for your code to break!
I would always use an Apex controller instead, caching the response to lighten the load.
String theme = UserInfo.getUiThemeDisplayed();
More info, including working sample code here:
https://developer.salesforce.com/blogs/isv/2016/04/introducing-ui-theme-detection-for-lightning-experience.html
I wouldn't recommend it, but you could look through the DOM for the data-aura-rendered-by property.
document.querySelectorAll('[data-aura-rendered-by]');
If you find it, you're in Lightning Experience.
There's no guarantee this won't change, so...be ready for your code to break!
I would always use an Apex controller instead, caching the response to lighten the load.
String theme = UserInfo.getUiThemeDisplayed();
More info, including working sample code here:
https://developer.salesforce.com/blogs/isv/2016/04/introducing-ui-theme-detection-for-lightning-experience.html
edited 2 mins ago
answered 39 mins ago
Shane Steinfeld
1,122418
1,122418
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f234395%2fget-user-theme-directly-in-lightning-component%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password