Skip to content

HTML5 Limitations

Dickson Law edited this page Apr 9, 2023 · 6 revisions

HTML5 Limitations

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 or new 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 textMode option key is set to true.
    • If you are uploading text files on the HTML5 export using MultipartBody, make sure that you are using TextFilePart with the correct newline settings.
  • Downloading images to storage and then using sprite_add will not work. Similarly, downloading OGG files to storage and then using audio_create_stream will also not work.
  • Only GET and POST requests are permitted natively. Other verbs (DELETE, PATCH, PUT) are shimmed by adding a _method parameter 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)

Clone this wiki locally