I am making an IE 11 add-on that can read an SVG element, wrap it with other HTML and then open up the pop-up with the newly generated HTML to have it printed.
The problem I am facing is that even though I have turned on "Run in IFrame" in my settings. The extension is unable to find most of the iframes on the page. Note that the site I am making this add-on for is https://app.powerbi.com. PowerBI is built using Angular and iframes are getting loaded dynamically.
Here is the code I have:
background.js
appAPI.ready(function($) {
appAPI.browserAction.setResourceIcon('icon.png');
appAPI.browserAction.onClick(function() {
appAPI.message.toActiveTab('print');
});
});
extension.js
function tryPrint($) {
console.log('===', document.location.href , '===')
}
appAPI.ready(function($) {
appAPI.message.addListener(function(msg) {
if(msg === 'print') tryPrint($);
});
});
With the code above, when I click the add-on button in the browser, I only see these output:
=== https://app.powerbi.com/groups/me/reports/4dba04c3-8c3e-4e9e-abb8-a1fa58165928/ReportSection ===
=== https://app.powerbi.com/ewaIsolation.cshtml ===
However, the following iframe is added to the page dynamically and it appears that the extension cannot find it.
<iframe sandbox="allow-scripts" name="visual-sandbox" class="visual-sandbox" src="/sandbox?plugin=YourVisual1456308971941" style="width: 1630.17px; height: 922.83px;"> . . . </iframe>