How to introduce mobile support?

Hi,I have a plug-in, which supports the interface watermark of PC, and I hope the mobile can also be supporting, but it seems that the configuration() of does not take effect, is there any case that can refer to the development of the mobile plug-in?
thanks

Hi @chenkaiyin1201,

Can you please provide the community with more information.
Like which product your working on, what is the code your using for the watermark,…

Can you also please move your topic to the relevant category in the community and add some tags?
Both will help you get an answer to you question quicker.

Cheers,
Peter

First of all,I am Sorry that I cannot provide more information because of the reason.
In short,I want to import javascript scripts into the confluence page.The code is in subsequent scripts, but the imported js script don`t work.

atlassian-plugin.xml

<device-type-renderer name="Mobile Renderer" key="mobileViewRenderer">
        <description>The renderer used for rendering content in Confluence Mobile.</description>
        <device-type>mobile</device-type>
    </device-type-renderer>

    <rest key="mobileRest" name="MobREST API" path="/js" version="1.0"/>
    <resource type="download" name="js/" location="/js/"/>
    <web-resource key="plugin-mobile-resources" name="Plugin Mobile Resources">
        <resource type="download" name="mobile-redirect.js" location="/js/plugin-mobile.js"/>
        <context>atl.general</context>
        <context>main</context>
        <dependency>confluence.web.resources:ajs</dependency>
    </web-resource>

js script

(function($) {
    AJS.toInit(function() {
        alert("123123");
        console.log("1234567");
        window.onload = function (ev) {
            console.log($.browser.mobile);
        }
    });
})(AJS.$);

The problem is probably that you can’t use AJS.toInit on mobile. (Source)

Instead you need to use:

ConfluenceMobile.contentEventAggregator.on("displayed", function() {});

So in your script you could do this:

(function($) {
    function onDocumentLoad() {
        alert("123123");
        console.log("1234567");
        window.onload = function (ev) {
            console.log($.browser.mobile);
        }
    }

    if (window.ConfluenceMobile) {
        ConfluenceMobile.contentEventAggregator.on("displayed", onDocumentLoad);
    } else {
        AJS.toInit(onDocumentLoad);
    }
})(AJS.$);

Can I ask May I ask about atlassian-plugin.xml?
Here is my configuration, but it only works on PC, not mobile

<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2">
    <plugin-info>
        <description>${project.description}</description>
        <version>${project.version}</version>
        <vendor name="${project.organization.name}" url="${project.organization.url}" />
        <param name="plugin-icon">images/pluginIcon.png</param>
        <param name="plugin-logo">images/pluginLogo.png</param>
    </plugin-info>

    <!-- add our i18n resource -->
    <resource type="i18n" name="i18n" location="plugin"/>
    
    <!-- add our web resources -->
    <web-resource key="=plugin-resources" name="plugin Web Resources">
        <dependency>com.atlassian.auiplugin:ajs</dependency>
        
        <resource type="download" name="plugin.css" location="/css/plugin.css"/>
        <resource type="download" name="plugin.js" location="/js/plugin.js"/>
        <resource type="download" name="images/" location="/images"/>

        <context>plugin</context>
        <context>atl.general</context>
        <context>atl.admin</context>
    </web-resource>
</atlassian-plugin>

Hi,you can use atl.mobile.confluence.view.content in your web-resource , and javaScript could run in mobile web

And also , javascript may require some other rules to follow in mobile web which I’m investigating (I need to make my web plugin avaliable with mobile device type , too)

I’m interested in answers to the original question in a more general way. It is good to know that some particular JavaScript API is not available in mobile for this app but then it’s death by a thousand cuts to figure out full mobile support for a plugin/app.

I’m thinking that the OP was asking for some reference documentation on how to develop mobile plugins. Does such a thing exist?