{"action":"opened","issue":{"url":"https://api.github.com/repos/IceCreamYou/Chrome-BigConsole/issues/9","labels_url":"https://api.github.com/repos/IceCreamYou/Chrome-BigConsole/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/IceCreamYou/Chrome-BigConsole/issues/9/comments","events_url":"https://api.github.com/repos/IceCreamYou/Chrome-BigConsole/issues/9/events","html_url":"https://github.com/IceCreamYou/Chrome-BigConsole/issues/9","id":123136567,"number":9,"title":"Allow running code in child frames","user":{"login":"IceCreamYou","id":203177,"avatar_url":"https://avatars.githubusercontent.com/u/203177?v=3","gravatar_id":"","url":"https://api.github.com/users/IceCreamYou","html_url":"https://github.com/IceCreamYou","followers_url":"https://api.github.com/users/IceCreamYou/followers","following_url":"https://api.github.com/users/IceCreamYou/following{/other_user}","gists_url":"https://api.github.com/users/IceCreamYou/gists{/gist_id}","starred_url":"https://api.github.com/users/IceCreamYou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IceCreamYou/subscriptions","organizations_url":"https://api.github.com/users/IceCreamYou/orgs","repos_url":"https://api.github.com/users/IceCreamYou/repos","events_url":"https://api.github.com/users/IceCreamYou/events{/privacy}","received_events_url":"https://api.github.com/users/IceCreamYou/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-20T06:24:59Z","updated_at":"2015-12-20T06:24:59Z","closed_at":null,"body":"Starting in Chrome 38, it is possible to execute code in child frames using the options parameter of [`chrome.devtools.inspectedWindow.eval()`](https://developer.chrome.com/extensions/devtools_inspectedWindow#method-eval) to specify a target frame by its URL.\r\n\r\nGetting target frame URLs, and keeping the list updated when those URLs change (by adding/removing frames from the DOM or by changing a frame's location) is actually a somewhat complicated problem. Options are:\r\n\r\n1. [Insert a script into every frame](http://stackoverflow.com/a/19288288/843621) that [communicates with the Dev Tools panel](https://developer.chrome.com/extensions/messaging) on window load and popstate (when `location.href` changes). This is probably the best option.\r\n2. Use the [`webNavigation.getAllFrames()`](https://developer.chrome.com/extensions/webNavigation#method-getAllFrames) method to get all frames in the [current tab](https://developer.chrome.com/extensions/tabs#method-getCurrent). However, this makes it complicated to track when the frame's location changes (e.g. if the user clicks a link in the frame).\r\n3. Target frame URLs can be retrieved by querying for frames (e.g. `document.querySelectorAll('iframe')` from the parent) and accessing the `.src` property of each frame. However, the same hoops have to be jumped through to monitor changes as in the second option.\r\n4. For same-domain, same-protocol frames, the `location.href` of each window in [`window.frames`](https://developer.mozilla.org/en-US/docs/Web/API/Window/frames) identifies the URL. However, the same hoops have to be jumped through to monitor changes as in the second option.\r\n\r\nThis issue is a request on behalf of a user who submitted feedback on the Chrome Web Store to add a new feature to BigConsole to choose a target frame where code should be executed. A new dropdown would need to be added to the code pane listing the available frames, populated using one of the methods above."}}