What is the proper way to use the Atlassian Connect History Module's pushState() method? (JIRA)

Nathaniel E Pendleton January 6, 2015

I am not getting the desired behavior from my code.

AP.require(["history"], function(history) {
    var diagramAnchorName = 'MyAnchor';
    history.pushState(diagramAnchorName);
    // Close viewer on back button
    history.popState(function(e) {
        if(viewer.isShowing()) {
            viewer.close();
        }
    });
});

When I put a breakpoint after history.pushState(), I can then execute history.getState() via console and get back the expected value ('MyAnchor'). However, the URL in the browser (Chrome) is never updated, and the back button goes back to the previous page, rather than executing my history.popState() callback.

Any advice would be very appreciated.

2 answers

0 votes
Nathaniel E Pendleton January 9, 2015

I am trying to use it from an iframe with my editor in it. Do you know of any ways others have dealt with similar situations?

0 votes
Christopher Whittington
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 8, 2015

History API will only change the URI on page modules. eg: generalPage, adminPage, etc. It will not work for webitems, webpanels, or jiraIssuePanels.

Are you trying to use it outside of a page?

Suggest an answer

Log in or Sign up to answer