DevTools: Improve browser extension iframe support
See original GitHub issueWhen react is inside an iframe, chrome extension for react devtools fails to detect react.
This is because the extension sets __REACT_DEVTOOLS_GLOBAL_HOOK__
only on the top level window. Apparently it’s possible to have __REACT_DEVTOOLS_GLOBAL_HOOK__
on iframes too by adding all_frames: true
in extension manifest.json. It was done by redux devtools extension in https://github.com/zalmoxisus/redux-devtools-extension/pull/56.
Have you considered adding all_frames: true
to chrome extension ?
Steps To Reproduce
- Create a file
react-main.html
<!DOCTYPE html>
<html>
<head>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
</head>
<body></body>
</html>
- Create a file
react-iframe.html
<!DOCTYPE html>
<html>
<head></head>
<body>
<iframe src="./react-main.html" />
</body>
</html>
- Open
react-iframe.html
in chrome
The current behavior
The expected behavior
Pull request: https://github.com/facebook/react/pull/18952
Issue Analytics
- State:
- Created 3 years ago
- Reactions:42
- Comments:53 (13 by maintainers)
Top Results From Across the Web
Using react dev tools inside iframe [In Chrome] - Stack Overflow
Solution suggested by the dev tools team: https://github.com/zalmoxisus/redux-devtools-extension/pull/56. "Adds the 'all_frames' option to the ...
Read more >Extending DevTools with Chrome Extensions
A DevTools extension adds functionality to the Chrome DevTools. It can add new UI panels and sidebars, interact with the inspected page, ...
Read more >45 Browser Extensions to Perform Accessibility Testing ...
Accessible Web Helper for Google Chrome is a powerful (and free) Google Chrome extension built to help you test your website's accessibility and...
Read more >Set Chrome policies for users or browsers - Google Support
Tip: Many admins leave the default settings and only configure settings, such as startup pages, new tab pages, apps and extensions, and themes....
Read more >A New Programmable Playground for Web Application Security
On the other hand, client-side defenses, especially in the form of modi- fied browsers or browser extensions, require constant vendor support or ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The frame limitation is mentioned in the docs, FWIW: https://github.com/facebook/react/tree/master/packages/react-devtools
It’s not a bug, just a known limitation. We currently suggest using the standalone version (as linked above) or (if you also control the iframe) passing the hook through from the parent: https://github.com/facebook/react/blob/d897c35ecfb7471b55e41933fd4d993b98dbf600/fixtures/devtools/regression/14.9.html#L9-L11
I don’t think that adding the Manifest setting you mentioned would be enough on its own to make the React DevTools extension detect and support versions of React running inside of iframes.
I’d be happy for you to take a shot at implementing it though if you’d like. We have a regression test that you could use to verify this:
That’s why the issue is still open, @alleksei37.