none
getElementById works in IE browser but not in iFrame

    Question

  • We have requirement to open Java application (third party) in iframe in ASP.NET MVC application.

    java struts render the HTML as follow (renders name attribute and not id attribute)

    <input type="hidden" name="operation" value="">

    java script method call

    function submitForCheck(value)
    {

      document.getElementById('operation').value = value;
      document.clientRateGroupForm.action = "CheckRGroup.do";
      document.clientRateGroupForm.submit();
    }

    if page is open in IE and click on check button it works and submit the form If same page is open in iFrame and click on check button, nothing works. It fails at javascript line

    document.getElementById('operation').value = value;

    Any idea why it works directly in IE and not in iFrame.

    Any suggestions to make it work in iFrame.

    <iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms"
        src="java application url"
        style="border: 0; width:1250px; height:800px;"></iframe>

    We are opening java application within iFrame and then it is independent, no interaction between java application within iFrame and outer MVC view.

    Tuesday, November 28, 2017 3:17 PM

All replies

  • What is "iFrame"? I have never heard of a browser called "iFrame".


    Sam Hobbs
    SimpleSamples.Info

    Tuesday, November 28, 2017 8:56 PM