Forum Discussion
4 Replies
- NicoB11 years agoLithium Alumni (Retired)
Hi Gursimrat ,
you can definitely use custom component and endpoints in the mobile version.
For the custom component, you just need to make sure that the components are added to the relevant mobile version of a particular page.
As per the endpoints, they are simply HTTP resources which can be accessed in the usual way (i.e. Ajax call). The same rules applies for the desktop version in terms of security restrictions (any call to the rest function uses the current user's permissions).
Thanks,
Nico
- Gursimrat11 years agoLeaderPerfect Nico, thanks
- YaseminR11 years agoLithium Alumni (Retired)
Hi NicoB ,
I wanted to ask a follow up question to this. The answer is the same for a custom component whether its content is coming from Community or an outside source (like a custom component displaying content from a CRM system for instance)? Anything else that would need to be done?
And does the answer change for Mobile v2?
Thank you so much,
Yase - NicoB11 years agoLithium Alumni (Retired)
Hi YaseminR
I have to answer your question with another question. How would you display the content of an external CRM into a Lithium component?
The only way would be via the http.client Freemarker context object and as you know http.client is not available in custom components. Which leaves endpoints as the only option.
Regardless (you might be using some backend customization instead of http.client) as long as you are able to retrieve the content and spit it into the component, I don't see any limitation in displaying the component on a mobile device.
Of course, when implementing the component's HTML you might want to take into consideration the current device and render a different HTML which best fit the current device. If the content coming from the external CRM is device sensitive then it might be a bit difficult. For example, if you're using some backend component to perform the call to the CRM system you might need to fake the user agent (i.e. overriding the User-Agent header by specifing the current user agent) to make sure that the http request is recognized as coming from a mobile device rather than a desktop browser (depending on which device is currently used by the user).
Regarding MobileV2 all components are client side. This means that the only way you have to retrieve content from external sources is through endpoints (which you can easily invoke using AngularJS $http or $resource services).
I hope this somehow answer your question.
Thanks,
Nico