Macro javascript does not work on confluence app.
Asked by Deepak Singh Butola:

As per the confluence developer guide, we have followed the given steps on below URL to run custom macros on mobile devices :

ConfluenceMobile.contentEventAggregator.on("displayed", function() {});  
URL: <https://developer.atlassian.com/server/confluence/making-your-macro-render-in-confluence-mobile/>

Custom macro javascript works fine using mobile chrome browser but doesn't seem to be working on the confluence server mobile app due to javascript code not getting executed.

Is there a way to execute the javascript files on the app using macros?


Answers:
author: Diego
body: Hello there, [@Deepak Singh Butola](/t5/user/viewprofilepage/user-id/1762800) . Your question is a good one, let us have a look.

You stated that ++*even after following the Developer guide*++, your macro is not displaying as expected.

Looking at our Confluence Server Mobile Application documents, we can see this:
> *Limitations and known issues*
>
> * *++**Some page macros won't display in the app or mobile web. You'll need to view the page in your browser (or switch to full desktop mode on your device).**++*
> * *Image and file upload is not currently available in the app.*
> * *Links to Confluence pages (from emails or other apps) don't automatically open in the app.*
> * *Admins can disable push notifications for your entire site.*

Here is the link to the document from which I took the excerpt:
> * ++**[\[Confluence Server\] Using the Confluence Server mobile app](https://confluence.atlassian.com/doc/using-the-confluence-server-mobile-app-947169252.html)**++

Our mobile and desktop interfaces are pretty different from one another. As you have noticed, we do recommend loading a different set of resources for the Mobile View. Here we can check this information:
> * ++**[\[Confluence Server Developer\] Macros with JavaScript and/or CSS](https://developer.atlassian.com/server/confluence/making-your-macro-render-in-confluence-mobile/#macros-with-javascript-and-or-css)**++

Could you clarify if ++*you checked this part of this documentation*++ ? There is a description on ++*how to approach macros that contain JavaScript and Confluence Server Mobile Application*++.

Also, you can have a look at this improvement suggestion were we try to improve the description of what is not supported within the Confluence Server Application:
> * ++**[\[Confluence Server\]\[CONFSERVER-58548\] Provide a more detailed list of macros and functions that are not available in the iOS and Android mobile app](https://jira.atlassian.com/browse/CONFSERVER-58548)**++

For more in-depth explanation and help with developing a question, you can reach our Sister community, the Atlassian Developer Community! Here, take a look:
> * ++**[\[Atlassian Developer Community\] Home](https://community.developer.atlassian.com/)**++

I hope this shines some light into your development path, Deepak! Looking forward to your reply.

comments: author: Deepak Singh Butola
body: Hey [@Diego](/t5/user/viewprofilepage/user-id/1188952) ,

Thanks, We have tried all the above-mentioned steps but none of them seems to be working. Only one approach i.e HTML macro will work but we don't want the user to edit and insert code into macros.  
Could you please provide us some precise solution which can work on an app.  

Regards,  
Deepak


Tags: confluence-development

confluence-server

questions-for-confluence

server