Search code examples
geolocationamp-html

Auto add place to a form field by GEO location AMP-HTML conform


Is there a way to add place to a form field by GEO location? It should be an AMP-HTML solution or a solution without JavaScript.


Solution

  • This is possible by rendering the form via amp-list. You can determine the GEO location based on the amp-list's src request (which is not cached) and then include the location in the returned JSON response. Inside the amp-list's mustache template you then can simply render the form with the correct location using the JSON response.