Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Javascript Injection and JS Libraries dependencies

Hi All,

I have to build a small plugin for Jira/Confluence in order to inject JS.

I am aware about Web Resource module type that allows to inject JS depending the different context of the application. It allows to inject a <script> based on an aggregate of JS source from the Application, where the declared dependencies are analysed in order to have the correct JS.

The generated html looks like 

{code:html}<script type="text/javascript" src="/confluence/s/71095c56c641f2c4a4f189b9dfcd7a38-CDN/en_US/8100/5084f018d64a97dc638ca9a178856f851ea353ff/3.1.1/_/download/batch/confluence.extra.livesearch:livesearch-macro-web-resources/confluence.extra.livesearch:livesearch-macro-web-resources.js?locale=en-US" data-wrm-key="confluence.extra.livesearch:livesearch-macro-web-resources" data-wrm-batch-type="resource"></script>{code}

But, how to process if a part of this injected JS has external dependencies not stored on the application. In final, I expect to have 

{code:html}
<script language="JavaScript" src="https://other.copany.com/js/SomeLibrarie.js"></script> {code}

Any idea ?

Thanks

1 answer

0 votes
DPK J Community Leader Dec 10, 2019

Hi @Vincent Thoulé _Alkaes_ 

This is not possible directly to add external web resources. But there are some workaround that you can use,

  • Best is, to download all external resources put them in plugin directory and use it from there
  • Or you can try somethings like, "Fetch Inject" (if it works fine in your scenario) https://git.habd.as/jhabdas/fetch-inject

Hopefully this helps.

Hi DPK J,

The solution could be a possibility if the downloaded resource is cached with some epxiration age, but I did not have yet find such usage in documentation.

The JS resource is a large one, and it would  be not aceptable to reload it all the time without benefit of Browser cache.

I should test it as soon as the implementation is confirmed.

V.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Introducing External Collaboration for Confluence

We’re excited to introduce external collaboration for Confluence, now available in early access. It is available to preview for Confluence Cloud Premium and Enterprise customers. (If you're not on ...

238 views 0 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you