Ifram & ASP.net

Altaf Patni
Altaf Patni used Ask the Experts™
Hello ,
 I want Ifram texbox and button using ASP.NET....
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
   <iframe id="Frame1" runat="server" name="I1" sandbox="allow-same-origin" seamless="seamless"></iframe> 

Open in new window

default.aspx.vb Page_Load
  Frame1.Attributes("src") = ".\WebForm1.aspx"

Open in new window

Altaf PatniSoftware Developer


i am using following code for trying to send a value from iframe to webpage and want to submit automatically  using java script, but getting an following error,
"Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "http://localhost:53182" from accessing a cross-origin frame."

My code is

      function load() {

           // get the iframe in my documnet
    var iframe = document.getElementById("myframe");
    // get the window associated with that iframe
    var iWindow = iframe.contentWindow;

    // wait for the window to load before accessing the content
        var doc = iframe.contentDocument || iframe.contentWindow.document;

        // find the target in the iframe content
        var target = doc.getElementById("txtLrNo");
        target.innerHTML = "Found It!";

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial