HOW TO
ArcGIS Survey123 forms can be embedded in websites using an <iframe> HTML element. The ArcGIS Survey123 Web App can generate <iframe> HTML for any publicly shared survey under the survey’s Collaborate tab (Survey > Share survey > Share this survey > Embed). The generated <iframe> element can then be copy/pasted into a website’s HTML.
It may be useful to observe how a Survey123 form appears or behaves when embedded in a website using an <iframe> element. However, a test HTML file including a Survey123 generated <iframe> does not load as a file in your web browser. Instead, it must be served via HTTP. See Mozilla’s documentation on opening HTML files locally for more information.
Test HTML files with Survey123 generated <iframe> elements can be served to yourself using Python's http.server module, assuming Python is installed, and Windows' IIS Web Management Tools and World Wide Web Services are enabled.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Survey123 iframe test</title> </head> <body> </body> </html>
Note: Saving this file in a new folder makes the next steps easier.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Survey123 iframe test</title> <style> .embed-container { position: relative; height: 0; padding-bottom: 80%; max-width: 100%; } .embed-container iframe, .embed-container object, .embed-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } small { position: absolute; z-index: 40; bottom: 0; margin-bottom: -15px; } </style> </head> <body> <div class="embed-container"> <iframe name="survey123webform" width="500" height="400" frameborder="0" marginheight="0" marginwidth="0" title="Bug Map Zoom Level" src="//survey123.arcgis.com/share/ae9c15b587494647b5186d69e81d042f" allow="geolocation https://survey123.arcgis.com; camera https://survey123.arcgis.com"> </iframe> </div> <script>var survey123webform = document.getElementsByName('survey123webform')[0]; window.addEventListener("message", e => { if (e.data) { var t = JSON.parse(e.data); "survey123:onFormLoaded" === t.event && t.contentHeight && (survey123webform.parentNode.style.height = t.contentHeight + "px") && (survey123webform.parentNode.style["padding-bottom"] = "unset") } });</script> </body> </html>
Get help from ArcGIS experts
Download the Esri Support App