From bc6099ed96361e42636a694f43be43e652d7b21f Mon Sep 17 00:00:00 2001 From: Daniel Roesler Date: Sat, 28 Feb 2015 15:37:43 -0800 Subject: [PATCH] get an iframe directly to bypass overrides, thanks to upsuper --- README.md | 29 +++++++---------------------- index.html | 30 ++++++++---------------------- 2 files changed, 15 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index a2dfa92..396c77a 100644 --- a/README.md +++ b/README.md @@ -23,29 +23,14 @@ function getIPs(callback){ || window.webkitRTCPeerConnection; var useWebKit = !!window.webkitRTCPeerConnection; - //bypass naive webrtc blocking + //bypass naive webrtc blocking using an iframe if(!RTCPeerConnection){ - //create an iframe node that doesn't allow plugins - var iframe = document.createElement("iframe"); - iframe.style.display = 'none'; - iframe.sandbox = 'allow-same-origin allow-scripts'; - document.body.appendChild(iframe); - - //create a nested iframe that doesn't allow javascript - var iframe2 = iframe.contentDocument.createElement("iframe"); - iframe2.sandbox = 'allow-same-origin'; - - //add a listener to cutoff any attempts to disable webrtc when inserting to the DOM - iframe2.addEventListener("DOMNodeInserted", function(e){ - e.stopPropagation(); - }, false); - iframe2.addEventListener("DOMNodeInsertedIntoDocument", function(e){ - e.stopPropagation(); - }, false); - - //get the RTCPeerConnection connection from the nested iframe - iframe.contentDocument.body.appendChild(iframe2); - var win = iframe2.contentWindow; + //NOTE: you need to have an iframe in the page right above the script tag + // + // + //