@@ -15,7 +15,25 @@ summary: >
1515Here are some tips on writing browser-based clients for the Weather API. This includes
1616frameworks like React and Vue, but also plain Javascript and older technologies like
1717AJAX/XmlHpptRequest. Even inline images ("hotlinking") is to some degree supported.
18+ Note that you can get still throttled if you site sends > 20 reqs/sec (total from
19+ all current users' browsers).
1820
21+ ## Example
22+
23+ This is about as plain an example as you can get with pure Javascript with no
24+ jQuery, TypeScript, React or other dependencies.
25+
26+ <script src =" ./assets/getForecast.js " ></script >
27+ <form name =" coords " action =" javascript:getForecast() " >
28+ <label for="lat">Latitude</label>
29+ <input type="text" id="lat" size="6" name="lat">
30+ <label for="lon">Longitude:</label>
31+ <input type="text" id="lon" size="6" name="lon"><br><br>
32+ <input type="submit" value="Submit"> <br><br>
33+ <textarea id="output" cols="60" rows="25" style="font-family: monospace, monospace"></textarea>
34+ </form >
35+
36+ See [ the script] ( ./assets/getForecast.js ) for source code.
1937
2038## Identification
2139
@@ -69,6 +87,13 @@ which are:
6987 - `Viewport-Width`
7088 - `Width`
7189
90+ * ([ Some sources] ( https://javascript.info/fetch-crossorigin ) claim the list is even shorter.)
91+
92+ {: .note }
93+ Apparently some browsers now have added ` User-Agent ` to the list of "safe" headers. However,
94+ according to our research, this does not include Firefox (as of v.136.0) which triggers a CORS fault.
95+ Also, while Chrome appears to accept setting the header, it is not actually sent to the server.
96+
72973 . The only allowed values for the ` Content-Type ` header are:
7398
7499 - ` application/x-www-form-urlencoded `
0 commit comments