I'm trying to inject javascript code below into iframe
element but I don't understand how I can achieve this. because since the code is written in ES6, I can't find other way I can put the code into iframe
element.
I'm aware that I can add javascript into iframe this way,
var scriptTag = "<script>alert(1)</script>";
$("iframe").contents().find("body").append(scriptTag);
but I don't understand how I can do that with code below.
import finder from '@medv/finder'
document.addEventListener('mouseover', event => {
const selector = finder(event.target)
console.log(selector)
}, true)
any help would be so appreciated :)