I am loading a domain into Iframe, there is a button "Delete". I want to click that button using Jquery or javascript. Chrome will not allow as SOP Policy.
<!DOCTYPE html>
<html>
<head>
<title>Exploit me</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
</head>
<body>
<iframe id ="myframe" src="index.html"></iframe>
<button id = "click_me">click for color</button>
<script>
$(document).ready(function() {
$('#click_me').click(function() {
// console.log("hu");
// var x = document.getElementById("myframe");
// var y = x.contentDocument;
// y.getElementById("click").click();
// y.body.style.backgroundColor = "blue";
document.getElementById("myframe").contentDocument.getElementById("click").click();
});
});
</script>
<!-- <script>
$(document).ready(function() {
$( "#click" ).click();
});
</script>
<script>
$('#click').click(function() {
alert("I am outer button");
});
</script> -->
</body>
</html>
My question here is, can I click into iframe loaded website through jquery and javascript which is added in my iframe.html