Electron.jl - Is there a way to display an html file loaded into a string variable?

I am constructing an html file that I want to display in an electron window. I accumulate the whole html file in a Julia string. I am wondering whether there is a way to display it without first writing it into a file.

For example,

using Electron
Window(URI("file:///.... "))

works.

Window(str)

does not work, where “str” contains the whole html file in one string.

Yea you can use data URI’s

Thank you for your reply. If I use URI’s as in

Window(URI(str))

I get

Unexpected start of URL
parse_url(::String) at parser.jl:213
URIParser.URI(::String) at parser.jl:301
include_string(::String, ::String) at loading.jl:522
include_string(::String, ::String, ::Int64) at eval.jl:30
include_string(::Module, ::String, ::String, ::Int64, ::Vararg{Int64,N} where N) at eval.jl:34
(::Atom.##102#107{String,Int64,String})() at eval.jl:82
withpath(::Atom.##102#107{String,Int64,String}, ::String) at utils.jl:30
withpath(::Function, ::String) at eval.jl:38
hideprompt(::Atom.##101#106{String,Int64,String}) at repl.jl:67
macro expansion at eval.jl:80 [inlined]
(::Atom.##100#105{Dict{String,Any}})() at task.jl:80

When I just feed the “str” as follows,

Window(str)

I get a blank window with the correct title and without any errors. As I mentioned in the original post, the “str” written to a file and read back using “URI” function, it displays the content without any problems.

Window(URI("file:///C:/folder/filename.html"))

By the way, the same file written to the “tempdir()” folder does not display the content at all on Windows 10.

This is perhaps a bit clumsy but works:

 style = """
<style type="text/css">
table {
border-collapse: collapse;
}
td, th {
border: 1px solid LightGray;
padding: 0.5rem;
text-align: right;
}
</style> \n"""

  #see (characters) https://en.wikipedia.org/wiki/Percent-encoding
  style = replace(style,"\""=>"%22")
  style = replace(style," "=>"%20")

  str = [create a string with the contents of the html table]
  str = string("<html>",style,"<table>",str,"</table></html>")
  str = filter(x -> !isspace(x), str)
  str = string("data:text/html,",str)
  win = Window(URI(str))