User agent with HTML forms
Thad Bogert
thad at technosolver.com
Thu Jan 28 16:50:57 UTC 2021
Hi All,
Kelly was able to point me to the the documentation for including HTTP headers in the $construct() parameters of a remote task. Thanks Kelly!
For posterity:
-------------------------------------------------
Cookie and Referer Headers
When a request arrives at the web server from an HTML form, there are some HTTP headers sent from the client that may be of interest to the remote task instance. These include “Cookie:” and “Referer”. (Note that a discussion of how the various HTTP headers work is beyond the scope of this document; there are many good sources of information on the Web). You can gain access to these parameters using the following mechanism.
In your HTML form, include an empty parameter with the name HTTP_<header name>, for example, HTTP_COOKIE. This is an instruction to the Omnis web server plug-in, telling it to insert the value of the corresponding HTTP header into the form parameter. This means that when $construct() runs, there is a column HTTP_<header name> in the row variable parameter, and its value is the value of the HTTP header. Note that the header value can be empty if it is either not present, or not available to the Omnis web server plug-in.
————————————————————————
Unfortunately this feature only seems to work with non-hyphenated header names. For example HTTP_Referer works but HTTP_User-Agent does not when using the Apache module. I will be sure to report the limitation to Omnis so that it can be addressed.
Thad
> On Jan 27, 2021, at 5:29 PM, Thad Bogert <thad at technosolver.com> wrote:
>
> Hi All,
>
> Does anyone know if there is a way to pass the user agent info of the client browser to a remote form that is submitting from a static HTML form?
>
> I have been able to create a workaround by populating a hidden form field with the navigator.userAgent property, but I am hoping for a solution where the info comes from the http header.
>
>
> Thanks,
>
> Thad
More information about the omnisdev-en
mailing list