Insert HTML after the body tag in JIRA

Alexey Zimarev May 6, 2013

We are trying to put JIRA into Websphere Portal navigation and it works OK except the WP code must be placed right after the body tag on each page. We placed it following the article about placing Google Analytics code but it is inserted inside a header with some styling applied, this makes all text with a href links blue. To what file we should move the code to be rendered before the header and still on each page?

6 answers

1 vote
Błażej O_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 6, 2013

Definitely javascript (jquery) in Announcement banner is a good wroking way to do this.

Try one of these, we use both of these in our jira instance for switching styles and additional scripts:

<script type="text/javascript">

jQuery(document).ready(
    function()
    {

    jQuery('body').prepend('INSERT YOUR HTML CODE HERE');

    }

    );
</script>

or simply:

<script type="text/javascript">

jQuery('body').prepend('INSERT YOUR HTML CODE HERE');

</script>
mehmet ozdemir April 20, 2016

Hi,

How to do apply This jQuery code added method for JIRA Service Desk Portal Customer View  ??

 

Thanks 

1 vote
Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 6, 2013

Have you tried the Annoucement Banner? If that does not work, you're gonna have to hack the decorators.

Alexey Zimarev May 6, 2013

Announcement banner is rendered inside the header, the same issue.

0 votes
mehmet ozdemir April 20, 2016

Hi,

How to do apply This jQuery code added method for JIRA Service Desk Portal Customer View  ??

 

Thanks 

vishal goyal April 3, 2019

did you get any solution for your query 

 

regards

Vishal Goel

0 votes
David at David Simpson Apps
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 6, 2013

Why not just put it in the Announcement Banner, then use JavaScript to move it to the correct place in the DOM?

Paste this into the Annoucement Banner:

<div class="my-custom-banner">my custom banner</div>

<script>
  AJS.toInit(function(){
    AJS.$('body').prepend(AJS.$('.my-custom-banner'));
  });
</script>

Alexey Zimarev May 6, 2013

David, your solution works, however JIRA pages obviously load without the portal navigation and after that when script is executed, the navigation bar appears. Since it is pretty large, visual experience is far from ideal.

0 votes
Alexey Zimarev May 6, 2013

Announcement banner is rendered inside the header, the same issue.

\decorators\navigator.jsp file looks ok but it does not work. The home page is surely rendered with another file, I don't know which one...

0 votes
codelab expert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 6, 2013

Have a look into this file ...\jira\webapp\decorators\navigator.jsp. There you'll find all information you need.

Alexey Zimarev May 6, 2013

\decorators\navigator.jsp file looks ok but it does not help. The home page is surely rendered with another file, I don't know which one...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events