0

I want to set a value in a Textbox which is present in external url. Im currently using this snippet

function func(){
    var childPage = window.open("extenal url(like www.google.com)");
    var textbox = childPage.document.getElemntsByName('textboxName')[0];
     textbox.value ="something";
}

But i'm getting "Access is denied" while retrieving the element ref.

Can we set any textbox of extenal url within our application by any other way. Thanks

NewLearner
  • 116
  • 3
  • 16

1 Answers1

1

Simple answer, No. If browsers allowed this there would be serious security flaws.

The only way you can update your textbox is by running the JavaScript from within the website in the iframe.

You would then do parent.document.getElementsByName('textboxName')[0];

Jamie Barker
  • 8,145
  • 3
  • 29
  • 64