JSFiddle - React, Tailwind, and code Playground
by not important
HTML
<div id="target"></div>
CoffeeScript
url = 'http://www.whatismyip.pw/'
formGroup = 'formAlpha'
iframe = document.createElement 'iframe'
iframe.id = 'formFrame'
iframe.width = 320
iframe.height = 480
iframe.src = 'google.com'
html = document.getElementsByTagName('body')[0]
html.appendChild iframe
iframeDoc = iframe.contentDocument
if !iframe.contentDocument.body
iframe.contentDocument.body = iframe.createElement 'body'
form = iframeDoc.createElement 'form'
form.method = 'get'
form.action = url
form.id = formGroup
form.setAttribute 'submit', 'formSubmit()'
formElements = [
{name: 'firstElement', value: 'firstValue'}
{name: 'secondElement', value: 'secondValue'}
]
for {name, value} in formElements
input = iframeDoc.createElement 'input'
input.type = 'hidden'
input.name = name
input.value = value
form.appendChild input
iframe.onload = ->
console.log iframe.src
script = iframeDoc.createElement 'script'
script.innerHTML += "document.getElementById('#{formGroup}').submit();"
iframeDoc.getElementsByTagName('body')[0].appendChild form
iframeDoc.getElementsByTagName('body')[0].appendChild script