"Uncaught ReferenceError: AP is not defined" in Macro Preview and Page Preview

Issue #2 resolved
Deniz Oğuz created an issue

This add-on works for normal page view, but in the macro preview or in the page preview it cause AP is not defined exception. I have attached the section causing the exception. it is "AP.require('_create-inner-frame', function(createInnerFrame) {" line below. Note that this is somewhere inside atlassian connect api, not the plugin code itself. I think something in newer connect api is not compatible. This add-on is also promoted as a sample add-on for connect developers so a lot of developers will face the same problem, like me :)

        //If the are the top frame (Confluence)
        if(window.top === window) {
            _AP.addonOriginMap = iFrameData.addonOriginMap || {};
            require(['connect-host', 'ac/cookie', 'ac/env', 'ac/inline-dialog', 'ac/dialog', 'ac/messages', 'ac/request', 'ac/history'], function(host){
                host.create(iFrameData);
            });
        } else { //If we are a plugin frame
            AP.require('_create-inner-frame', function(createInnerFrame) {
                createInnerFrame(iFrameData);
            });
        }

Comments (6)

  1. Robert Massaioli repo owner

    Thanks for this bug report Deniz! I'll try and look into that further.

    @khanhfucius / @mstaas is this related to the iframes inside iframes issue that was discovered recently?

  2. Log in to comment