Hello all.
I want to use ODK to design certain question that i want it to display on my website without living my website.
Just like how the odk webform is but without I want it to automatically appear on my website through embedding, integrating or the like without clicking on the webform link.
Is there any help I can do this?
Thank you very much.
It looks like the Enketo Site is no longer operational. Is this function still usable? Will the new ODK Web Forms that is being developed include this function, IE the ability to embed a form into a different website?
Yes, you can still embed an Enketo form in a iframe on a different website.
If you are using Central, embedding is off by default because it exposes you to cross-site scripting attacks. To enable this functionality, edit your odk.conf.template to whitelist the sites where you want to embed. For example, if you want to embed on https://example.comhttps://company.sharepoint.com, you'd make these changes.
Please remove reallyawesome/no/seriously from the config, here we just need to provide origin of the application where Form is embedded. Also add the same line after try_files $uri $uri/ /index.html;
Another thing I noticed in your HTML is that you are not setting parentWindowOrigin query parameter in the iframe src, without that you won't received any messages from the iframe.
Not totally sure what's happening, maybe sites.google is blocking somehow. Is it possible for you to record network requests with a tool like https://jam.dev and share the link in my DM?
To provide wider visibility to the community. Here are our findings related to embedding a Form (public link) in Google Sites.
When you embed an iframe in Google Site, it is embedded in nested iframes, each coming from a different google domain, so we need to add all domains to Content-Security-Policy in odk.conf.template.
By default Google Sites are hosted on Google's domain with each site/user getting their on path. For e.g. https://sites.google.com/view/odktest here odktest is for a specific user. In this case we need to add full path to the Content-Security-Policy so that my Form is embeddable on my google site and not on others. But there is an issue with this approach that it works only in Firefox and doesn't work on Chrome because of an existing bug: https://csplite.com/csp/test355/#test. I wouldn't recommend adding the whole sites.google.com to the CSP because that would mean any google site would be able to host your Form causing security nightmares.
Theoretically, if you configure your google sites with custom domain then you might be able to configure CSP correctly and it would work for all browsers unless Google does some shenanigans in this area as well.