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

Getting "referenceerror cryptojs is not defined" in firefox when using hash256 in announcement banner.

Kamal Saini Oct 06, 2014

Hi,

I am using below code in announcement banner of JIRA

<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/sha256.js" type="text/javascript"></script>

<script>
// Fetch JIRA userid from metadta tags
   var customUserId = '';
   metaTagCollection = document.getElementsByTagName('meta');
   for (i=0;i<metaTagCollection.length;i++) 
   {
     if(metaTagCollection[i].getAttribute("name") == "ajs-remote-user")
     {
       customUserId = metaTagCollection[i].content;
       alert(customUserId); // it gets printed on alert message
       //debugger;
       var hashedId = CryptoJS.SHA256(customUserId);//getting error here in FF debug
       alert(hashedId); // this is not getting printed in firefox but in IE
     }
   }
</script>

When I hit JIRA and login then above code successfully run in IE and I am able to get the hashed value of userId but when I do same in firefox it throws error in debugger and only first alert print not the second one.

JIRA version: 6.2.7

Firefox version: 32.0.3

IE version: 8

The test code below when saved as "test.html" (not using in JIRA announcement banner) runs fine on same firefox version.

<html>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/sha256.js"></script>
<script>
    var hash = CryptoJS.SHA256("Message");
    alert(hash); // gets printed on firefox as well. No error.
</script>
</html>

 

Please help me here about what I am doing wrong or need to do extra?

1 answer

1 accepted

0 votes
Answer accepted
Kamal Saini Nov 04, 2014

I have downloaded the JS and localy added in a file on my server and its done.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira

Try Jira Cloud for Outlook: Organize your work without leaving your inbox

Hi Atlassian community, My name is Max and I work on the product integration team at Atlassian. I am pleased to announce the early access program for the Jira Cloud add-in for Outlook. This add-in...

844 views 0 12
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