I didn't want to put this page up public, so I just used the tools on my mac to base64 the page that I wrote:
openssl enc -base64 -in my-page.html | tr -d "\n" && echo ""
I used the tr to strip out the newline characters and the last echo was to just make it easier to copy and paste from terminal.
So I emailed the base64 text, but prepended with "data:text/html;base64," (no quotes). For example, you wanted to have a web page with "hello world" you might do something like this:
echo "hello world" | openssl enc -base64 | tr -d "\n" && echo ""
That will give you aGVsbG8gd29ybGQK to which you'd put into the url bar of safari
data:text/html;base64,aGVsbG8gd29ybGQK
(I understand for "hello world" you probably should have the content type of "text/plain" rather than "text/html", but I don't want to confuse anything too much.)
The only issue that I ran into was that the page didn't look very nice on the iphone. Doing a bit more digging I found a meta tag that I could drop in that fixed everything:
<meta name="viewport" content="width=device-width,user-scalable=no" />
No comments:
Post a Comment