Getting "RPC request rejected (Bad origin)" while loading iframe window in macro edit pop up window

Hi Team ,

I’m trying to load an iframe window in left section [parameter] Macro pop up view . I tried it by overriding the “AJS.MacroBrowser.setMacroJsOverride” . But I’m getting Getting “RPC request rejected (Bad origin)” while loading iframe window . I checked this error is coming from confluence batch.js file .

I have configured it using code mentioned below.

This is my hidden-parameter-field.js file code.

AJS.MacroBrowser.setMacroJsOverride(“helloworld”, {
fields: {
string: {
“iframewindow”: function (param) {
var paramDiv = AJS.$(Confluence.Templates.MacroBrowser.macroParameter());
var input = AJS.$("#macro-param-div-iframewindow", paramDiv);
var label = document.createElement(“label”);
label.innerHTML = “iframedisplay”;
label.setAttribute(“for”, “macro-param-iframedisplay”);
var frameElement = ; // Here I’m calling 1 javascript function which is returning me a complete iframe window of a page.
paramDiv.empty();
paramDiv.append(label);
paramDiv.append(frameElement);
return AJS.MacroBrowser.Field(paramDiv, input);
}
}
}
});

This is my plugin.xml

com.atlassian.auiplugin:ajs confluence.editor.actions:editor-macro-browser macro-browser myConfluenceMacro

<xhtml-macro name="helloworld" class="com.atlassian.tutorial.macro.helloworld" key='helloworld-macro'>
    <description key="helloworld.macro.desc"/>
    <parameters>
        <parameter name="iframewindow" type="string"/>
    </parameters>
</xhtml-macro>

I’m able to view the iframe in my preview section of my macro pop up window by using document.appendchild method. { var frameElement = ; // Here I’m calling 1 javascript function which is returning me a complete iframe window of a page.} But it is giving me “RPC: request rejected (bad origin):” error when i try to load same iframe window in left parameter section of macro popup view.

I have also attached the snapshot of the error along with this thread.