How to write JavaScript at the portal of JSD?

I want to alert some message to users who viewed the articles of KnowledgeBase to click the helpful feedback button at portal of JSD.
So is there any way to surport that?
I will be very grateful for someone’s answer.

Hi Ming,

You can define a web-resource in your atlassian-plugin.xml. The context of this resource should be customerportal, so your resource will be available at any customer portal.

<!-- Customer Portal web resource -->
<web-resource key="customer-portal-resources" name="Web Resources for customer portal">
  <resource type="download" name="script.js" location="/js/script.js"/>

This script.js file will be loaded when you open the portal.

1 Like

How to find my atlassian-plugin.xml ? I am not able to find it in Jira Server Prod Environment.

Hi @MingP,

I saw the tag JSD Development in the Developer Community so I thought you asked about app (plugin) development.

JSD does not support to inject JS code into the customer portal, please read this answer:

BTW: We can write a P2 plugin to do this!

I have the problem of adding a js code to Customer Portal. I have tried your solution and it does not help. I have added 2 contexts: “customerportal” and “jira.view.issue”. JS code is working on jira issue page, but does not on the customer portal pages. I have even tried to add a web panel to the customer portal page. In the panel view I have added a “script” tag and included another JS code. The panel itself is seen on the customer portal page, but JS code does not work. What could be a problem here?