0

There are several posts on this, but no solution worked for me. I have parent.com and iframe in that loading child.com

I want to access value of an input field which is inside in child.com (inside iframe)

here is what I tried so far

document.getElementById("iframeID").contentWindow.document.getElementById("input").value;

jQuery("#iframeID").contents().find('#input').val();

window.frames[0].getElementById("input").value;

jQuery('iframe[name=iframe]').contents().find('#input').val();

every attempt is resulting the same response

Blocked a frame with origin "parent.com" from accessing a frame with origin "child.com". Protocols, domains, and ports must match.

I dont how this worked for others and many accepted these answers.

CodeRows
  • 933
  • 1
  • 9
  • 15
  • Do you have control of both pages or only parent page? You can't access child page the way you want. – Felippe Duarte May 18 '16 at 18:02
  • Possible duplicate of [Access iframe elements in JavaScript](http://stackoverflow.com/questions/1451208/access-iframe-elements-in-javascript) – Felippe Duarte May 18 '16 at 18:04
  • @FelippeDuarte I dont think that this is a duplicate of that, I mentioned that the two domains are different. – CodeRows May 18 '16 at 18:07

0 Answers0