-
Notifications
You must be signed in to change notification settings - Fork 1
HTML5 Limitations
Dickson Law edited this page Apr 9, 2023
·
6 revisions
HTTP requests are limited on the HTML5 and Opera GX exports due to restrictions in browser-side JS. Please keep these points in mind:
- Cross-domain requests are forbidden unless the target implements CORS permitting access.
- HTTPS-to-HTTP requests are forbidden.
- There is no native access to actual files. When adding file attachments for a multipart body, you may have to get the content some other way, then simulate a file using
new StringFilePart(fakefilename, body)for text files ornew BufferFilePart(fakefilename, buffer)for binary files. - Buffer loading and saving functions on the HTML5 export work using Base64 instead of verbatim (example:
buffer_load).- If you are downloading text files on the HTML5 export for use with text file functions or INI file functions, make sure that the
textModeoption key is set totrue. - If you are uploading text files on the HTML5 export using
MultipartBody, make sure that you are usingTextFilePartwith the correct newline settings.
- If you are downloading text files on the HTML5 export for use with text file functions or INI file functions, make sure that the
- Downloading images to storage and then using
sprite_addwill not work. Similarly, downloading OGG files to storage and then usingaudio_create_streamwill also not work. - Only GET and POST requests are permitted natively. Other verbs (DELETE, PATCH, PUT) are shimmed by adding a
_methodparameter to the body containing the verb and sending with POST instead, which is a convention that most web application APIs and frameworks support. These functions implement this convention and activate it when the runner detects that it is running in a browser (i.e.os_browser != browser_not_a_browser || os_type == os_operagx):xhr_delete(url, body, options)xhr_patch(url, body, options)xhr_put(url, body, options)-
xhr_request(verb, url, body, options)(when the verb is not GET or POST)