Skip to content

Instantly share code, notes, and snippets.

@sgentle
Created October 3, 2017 03:43
Show Gist options
  • Save sgentle/0679ff0fc67c3ba77bc238fb166b0f30 to your computer and use it in GitHub Desktop.
Save sgentle/0679ff0fc67c3ba77bc238fb166b0f30 to your computer and use it in GitHub Desktop.
<script>
const url = 'chrome-devtools://devtools/bundled/inspector.html?nodeFrontend=true'
fetch(`http://localhost:${location.search.slice(1)}/json`)
.then(res => res.json())
.then(results => results.find(x => x.url == location).webSocketDebuggerUrl)
.then(wsurl => ({then: addEventListener.bind(new WebSocket(wsurl), 'open')}))
.then(ev => ev.target.send(JSON.stringify({
method: 'Page.navigate',
id: 0,
params: {url}
})))
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment