Forum Discussion

clemlith's avatar
clemlith
Expert
12 years ago

CommunityJsonObject in mobile version

Hi everyone,

 

In the desktop version of a community there is a CommunityJsonObject available.

This is pretty usefull to get the current whole path via the WebTracking node.

 

Do you know if there is an equivalent in the mobile version ?

 

Clement

  • Hi,

     

    the LITHIUM.CommunityJsonObject is available on mobile as well and not limited to desktop. However, it may depend on the specific device supporting Javascript.

     

    Please note that testing the mobile view using the "?device-view=mobile" parameter in the browser will disable Javascript, so the variable will not be available. You will need to either use a mobile device or change the user agent string of the browser (the easiest is test this on safari with the Developer menu).

     

    Hope it helps,

    Chiara

  • AdamN's avatar
    AdamN
    Khoros Oracle

    Hmmm, good question. From what I can tell there doesn't seem to be. I'd suggest submitting this idea to our idea exchange:

    http://lithosphere.lithium.com/t5/customer-ideas/idb-p/Lithium_Ideas

     

    In the mean time, you could always use FreeMarker to construct your own similar JavaScript object. Note that this code snippet is untested, and just an idea to get you going in the right direction:

     

    MyCommunityJsonObject = {
      "User" : {
        "login" : "${user.login?json_string}"
      },
      "Community" : {
        "id" : "${community.id?json_string}",
        "title" : "${community.title?json_string}",
        "shortTitle" : "${community.shortTitle?json_string}"
      },
      ...
    };

     

    • clemlith's avatar
      clemlith
      Expert

      Hi Adam,

      Thanks for your feedback.

      I will submit an idea.

       

      Thank you also for the suggestion about building my own JSON object.

      I noticed that you have added a json_string parameter to every method call but I do not see any reference to this in the TKB articles dedicated to context objects.

       

      Do you have further informations about this ?

       

      Clement