{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react/issues/1718","labels_url":"https://api.github.com/repos/facebook/react/issues/1718/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react/issues/1718/comments","events_url":"https://api.github.com/repos/facebook/react/issues/1718/events","html_url":"https://github.com/facebook/react/issues/1718","id":36027869,"number":1718,"title":"IFrame onLoad event with React","user":{"login":"sahat","id":544954,"avatar_url":"https://avatars.githubusercontent.com/u/544954?v=3","gravatar_id":"","url":"https://api.github.com/users/sahat","html_url":"https://github.com/sahat","followers_url":"https://api.github.com/users/sahat/followers","following_url":"https://api.github.com/users/sahat/following{/other_user}","gists_url":"https://api.github.com/users/sahat/gists{/gist_id}","starred_url":"https://api.github.com/users/sahat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sahat/subscriptions","organizations_url":"https://api.github.com/users/sahat/orgs","repos_url":"https://api.github.com/users/sahat/repos","events_url":"https://api.github.com/users/sahat/events{/privacy}","received_events_url":"https://api.github.com/users/sahat/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/react/labels/Type:%20Bug","name":"Type: Bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2014-06-18T21:09:06Z","updated_at":"2015-10-30T03:24:05Z","closed_at":"2015-04-29T09:00:32Z","body":"I have the following iframe element rendered in one of my React components:\r\n```html\r\n<iframe ref=\"iframe\" src={this.props.url} width=\"100%\" height=\"100%\" frameBorder=\"0\"></iframe>\r\n```\r\n\r\nI have tried adding `onLoad` event as well as attaching `onload` directly to DOM like so:\r\n\r\n```js\r\nthis.refs.iframe.getDOMNode().setAttribute('onload', this.getUrl);\r\n```\r\n\r\nWhere `getUrl` is the function of my React component:\r\n\r\n```js\r\ngetUrl: function() {\r\n    var path = this.refs.iframe.getDOMNode().contentWindow.location.pathname;\r\n    console.log(path);\r\n},\r\n```\r\n\r\nExcept that won't work. if I set attribute to `\"getUrl()\"` - IFrame will look for that function in the global scope, if i set it to the above, IFrame won't recognize React component's `this.getUrl` function.\r\n\r\n##### In Short: I want to notify the React component whenever a URL changes inside the iframe. \r\n"},"comment":{"url":"https://api.github.com/repos/facebook/react/issues/comments/152402682","html_url":"https://github.com/facebook/react/issues/1718#issuecomment-152402682","issue_url":"https://api.github.com/repos/facebook/react/issues/1718","id":152402682,"user":{"login":"jimfb","id":9595985,"avatar_url":"https://avatars.githubusercontent.com/u/9595985?v=3","gravatar_id":"","url":"https://api.github.com/users/jimfb","html_url":"https://github.com/jimfb","followers_url":"https://api.github.com/users/jimfb/followers","following_url":"https://api.github.com/users/jimfb/following{/other_user}","gists_url":"https://api.github.com/users/jimfb/gists{/gist_id}","starred_url":"https://api.github.com/users/jimfb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimfb/subscriptions","organizations_url":"https://api.github.com/users/jimfb/orgs","repos_url":"https://api.github.com/users/jimfb/repos","events_url":"https://api.github.com/users/jimfb/events{/privacy}","received_events_url":"https://api.github.com/users/jimfb/received_events","type":"User","site_admin":false},"created_at":"2015-10-30T03:24:05Z","updated_at":"2015-10-30T03:24:05Z","body":"@varungupta85 Ok, perfect, thanks!"}}