disable-devtool script inside an iframe auto redirects to the specified URL page
imranhome1 opened this issue · comments
Hi, the disable-devtool script inside an iframe auto redirects to the specified URL page instead it should wait if there is any activity like using of devtools on the parent page.
I have moved the script outside the iframe and found it detect it as an open tool just like inspect element and redirect to the URL.
Can you please fix this to avoid iframe.
I got the same issue, where the page with iframe will be redirected back to the last page. Please fix this bug
Yes it does the same to me, i had to remove this JS from page.
Any way to fix this issue? :(
Here's my workaround for this
This will disable the script when loaded in an iframe
<!-- disable dev tools -->
<script nonce="">
function inIframe () {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}
window.onload = function() {
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = 'https://cdn.jsdelivr.net/npm/disable-devtool@latest/disable-devtool.min.js';
if(!inIframe()){
s.setAttribute('disable-devtool-auto','');
s.setAttribute('url','https://google.com');
}
s.setAttribute('nonce','');
try {
document.body.appendChild(s);
} catch (e) {
document.body.appendChild(s);
}
}
</script>
@milindpatel63 Am not sure, disabling the script through iframe is not a workaround. We need a way to make it work along with iframe and get this issue fixed.
@imranhome1 @josephmiller2000 @karchung0930 @milindpatel63
Fixed! Please upgrade to Version 0.1.9