I'm trying to insert into my webpage a form which is located in an external webpage.
I don't have the direct url to this form, so I'm trying to navigate the frame in this way:
function showForm() {
        var newIframe = document.createElement('iframe');
        newIframe.width = '800'; newIframe.height = '400';
        newIframe.src = "websiteURL"
        document.body.appendChild(newIframe);
        window.frames["iframe"].document.getElementById('HM_Item1_4_1_1').click();
    }
But from the console I get:
Uncaught TypeError: Cannot read property 'iframe' of undefined
The homepage of the external website is loaded, but the redirection isn't working.
 
     
    