I have a page wich fills the advert formular with the Xing user information. Originally the action will be triggered with a script on my page:
<script type="xing/login">
{
"consumer_key": "############"
}
The button on the page is a div inside Iframe It functions correctly when the user click the Xing Login button. But now I want the page to trigger the button automatically as soon as the page is loaded with this function:
$(document).ready(function () {
function tryClickXing() {
try {
var iframe = document.getElementsByTagName("IFRAME")[0];
var doc2 = iframe.contentDocument
var button = doc2.getElementById("xing-login")
button.click();
} catch(e) {
window.setTimeout(tryClickXing,100)
}
}
tryClickXing();
});
What I get though is "Uncaught DOMException: Blocked a frame with origin "https://www.xing.com" from accessing a cross-origin frame."
What am I doing wrong????