Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Workaround to get to JavaScript functions in Chrome in Bonfire?

Levi Ma
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 21, 2011

Hello,

I created some JS functions in my app: e.g. 'document.getMyAppsBuildNumber()' returns the build number which we can populate via Bonfire's variables into a JIRA issue field.

That's the idea at least! But it's not working in Chrome. I do get a result from that call using IE9+Bonfire.

{quote} Chrome and Safari effectively run extension scripts in a sandbox, allowing access to the DOM but not global variables and functions{quote}

which is what I am experiencing in Bonfire + Chrome.

If I check http://code.google.com/chrome/extensions/content_scripts.html it seems there could be a workaround possible: have some shared place to set the answer in the application to the question asked by Bonfire. So a bit of indirect passing of variables.

But I guess that means that there is some development needed in the Bonfire for Chrome extension, as well as some extra coding in our application.

Or is there a workaround for such custom JS variables and functions?

2 answers

1 accepted

0 votes
Answer accepted
gdavidson
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.
November 22, 2011

At the moment there is no workaround other than the DOM access methods suggested by Google.

It does raise an interesting question of having a standardised access wrapper in Bonfire, so that you would only need to create hidden HTML elements in the right format, then access their contents in a variable with something like bonfire.meta[name].

I've raised a feature request at https://jira.atlassian.com/browse/BON-607 to address that issue.

0 votes
mikedavies
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 11, 2011

Hey I think I might have something to fix your problem. You can perform synchronous AJAX requests with Bonfire and Chrome. So instead of a javascript method called getmyAppsBuildNumber(), you would have a web service/script sitting there waiting for requests.

You can read more about it on a blog post I made about this issue: http://mikemurko.com/general/ajax-variables-in-atlassian-bonfire-for-jira-to-access-session-state/

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Upcoming Apps & Integrations Events