ng-inspector icon indicating copy to clipboard operation
ng-inspector copied to clipboard

Add support for AngularJS apps inside iframes

Open rev087 opened this issue 10 years ago • 10 comments

The extension currently doesn't support inspecting Angular apps inside iframes. Users reported this issue in the context of:

  • Umbraco
  • SharePoint 2013

rev087 avatar Apr 03 '15 18:04 rev087

Kicking off some brainstorming for how to accomplish this.

I don't believe this will be super easy, due to the fact that our injected ng-inspector.js runs in the context of the top frame, and won't be able to break cross-origin restrictions to read the DOM tree in the iframe, or to overwrite the angular bootstrapping method.

However, we can probably accomplish it using postMessage API. We would need to configure the extension in Chrome and Safari to load in every frame of the document (automatic in Safari, a setting in the Chrome manifest). Then, any changes in the iframe's app would send a message/notification up to the parent document, advising it to update the ng-inspector panel. The app in the iframe could then display normally. If there is an app in the parent document and the child document, I imagine the ng-inspector panel would use the same display it does for 2+ apps now.

I suspect that the plan above would require a significant refactor of the existing code, if we don't want things to get messy. If we went this route, we would probably want to create some sort of generic way to pass messages that will update the inspector panel, and then have both the top documents updates and the iframes updates going through that same pipeline.

DrewML avatar Apr 11 '15 08:04 DrewML

+1 for this.

saiichihashimoto avatar Apr 25 '15 06:04 saiichihashimoto

+1 on this, too.

altsanz avatar Apr 30 '15 00:04 altsanz

+1

deini avatar May 29 '15 21:05 deini

Another implementation could use chrome.runtime.sendMessage instead of postMessage. This would remove the necessity to deal with interfering messages from the webpage itself. This is a chrome extension only feature, though.

saiichihashimoto avatar May 29 '15 21:05 saiichihashimoto

+1 (for apps inside Salesforce.com platform)

VictorPascualV avatar Jun 12 '15 13:06 VictorPascualV

+1 as I am currently working on iframe widgets.

Manveroo avatar Aug 20 '15 05:08 Manveroo

+1

ppollono avatar Sep 16 '15 15:09 ppollono

+1

vodun avatar Sep 17 '15 22:09 vodun

Would it work just by loading ng-inspector.js in every frame? https://developer.chrome.com/extensions/content_scripts#all_frames

gregbradley avatar Oct 29 '15 06:10 gregbradley