First question, is it even possible to write a URI (presumably http://
) that will make a browser display some plaintext content, where the content is hardcoded into the URI itself (aka not served by a web server)?
My goal is to create a QR code that, when scanned, will display pre-encoded text content, regardless of device, OS, or internet connectivity. The simplest way I can imagine doing this is for the QR code to encode a URI that is opened by web browsers, since most devices with QR-scanning capabilities will also be capable of opening said link in a browser.
This is the tricky part: I would like the browser to open a plaintext page (which I believe is the same as the text/plain
MIME type) without having to make a web request to a remote server. I would like the text content of the page to be hardcoded into the URI itself. I do not want to rely on JavaScript to display the text content. The goal is that this QR code (or the hyperlink encoded therein) could be opened on any modern device and produce a webpage displaying text, with no specific software required besides a web browser.
http:
,https:
,ftp:
,webcal:
,mailto:
, andjavascript:
, to name a few that are commonly opened by web browsers by default. I know for a fact I could perform my task with a singlejavascript:
link, but most browsers have restrictions that will only run JS in the form of bookmarklets, if at all, so that wouldn't be a broadly-compatible implementation.