Can Codea use openURL to open a .html file stored in Codea documents folder?

Dear Codea Community,

Does anyone know if it is possible to use:


To open a local file (e.g. in Codea’s documents folder)?

I was hoping to get openURL to open and display html code that I have stored in Codea’s document folder. I’ve tried:

openURL(asset.documents.Myfile, true)



But those don’t seem to work.


@SugarRay I don’t know of anything in Codea that does that, but if you specify “false” in the openUrl command, it opens the url in an external browser. If you can find a browser that shows the data maybe you can use that.

Thanks for the reply, @dave1707 :blush:

@SugarRay you can do this, here’s how:

Here I have a file called index.html in my Codea documents directory, I can open it by doing:

openURL("file://" .. asset.documents.index.path, true)

Great, @sim, thanks so much! That will be very helpful! Maybe include that in the next releases documentation?

Have a good upcoming week :blush:


What is the .path used for at the end of asset.documents.index.path?

I would have thought my Codea’s file syntax that it would have just been:

openURL("file://"..asset.documents.index, true)

I tried opening up a file in my Codea documents directory just like your example (a simple .html file named ‘index.html’), and wouldn’t open (no error, no browser opening). Yet, using openURL to open up an external web page works just fine.

Any suggestions?

Thanks :blush:

You need to use .path on the end of the asset key to turn it into an absolute string version of the file path, this is needed when constructing a file:// URL to give to the web browser

This is actually in the documentation under Graphics → assets and Graphics → Using Assets, though not the explicit case of using openURL with them

I was able to open a browser to a local file named index.html by using the syntax I showed above (with the .path property to get the actual asset path string)

Thanks for clarifying, @sim, and I got it working, too :+1: (Sorry, I don’t know why it wasn’t working before).