Hi Rob, thanks your reply. I’ve added Worona in the key words.
I have tried using the following:-
local function webListener(event) print("showWebPopup callback") local url = event.url if( string.find( url, "http:" ) ~= nil or string.find( url, "mailto:" ) ~= 1 ) then print("url: ".. url) system.openURL(mailto:) end return true end
This does not achieve clickable mailto links.
The App has a file called html_server.lua, I have copied the code below.
This seems to be where the issue is. Line 146 to 157 seems to where you could perhaps control the behaviour of a tapped mailto link. I don’t what you would do though. The code is of course lua. Any ideas on what this file does and a work around to get mailto: links working would be greatly appreciated. I think the file has something to do with serving the json data to the device screen. I am way out of my depth here so that maybe rubbish. This is great little app and I would happily buy it if I could get this working. The App developers don’t seem to understand my issue which is why I’m posting on here. My use of the app required mailto links to pop the device mail client.
local worona = require "worona" local function newService() local socket = require "socket" local html\_server = {} -- Parse values from query local function getArgs( query ) query\_pos = string.find( query, "/?" ) --: get position of the ? query = string.sub( query, query\_pos+2 ) --: remove everything before that local parsed = {} local pos = 0 query = string.gsub(query, "&", "&") query = string.gsub(query, "<", "\<") query = string.gsub(query, ">", "\>") local function ginsert(qstr) local first, last = string.find(qstr, "=") if first then parsed[string.sub(qstr, 0, first-1)] = string.sub(qstr, first+1) end end while true do local first, last = string.find(query, "&", pos) if first then ginsert(string.sub(query, pos, first-1)); pos = last+1 else ginsert(string.sub(query, pos)); break; end end return parsed end --: creates a retrieves a new server function html\_server:newServer( options ) --: local variables local success, err, server --: defaults local options = options or {} local host = options.host or "localhost" local port = options.port or "1024" local backlog = options.backlog or 32 local timeout = options.timeout or 0 --: start the tcp server server, err = socket.tcp() --: reuse the address if it exist server:setoption( "reuseaddr" , true ) if server ~= nil then worona.log:info("html\_server: starting initialization") --: define a host and port for the server success, err = server:bind( host, port ) if success == 1 then worona.log:info("html\_server: bind to " .. host .. ":" .. port) --: start listening to a number of incoming connections success, err = server:listen( backlog ) if success == 1 then worona.log:info("html\_server: listening to a max of " .. backlog .. " connections" ) --: set the timeout of the accept() process. this is a blocking process, so until it receives something it will block the execution --: we are going to use the corona Runtime:addEventListener( "enterFrame" , function ) so we can set the timeout to nothing (0) success, err = server:settimeout( timeout ) if success == 1 then worona.log:info("html\_server: success setting a timeout of " .. timeout ) --: everything went fine, return the server worona.log:info("html\_server: initialised succesfully, returning") --: add the server to the html\_server table html\_server.server = server --: return the server and end function return server end end end end --: something went wrong, return nil and the error return nil, "html\_server: failed with error " .. err end --: function to retrieve clients function html\_server:processPetition( server ) local server = server or html\_server.server return function() --: local variables local client, message local err = "server is nil" local headers = [[HTTP/1.1 200 OK Date:]] .. worona.date:convertTimestampToDate( os.time() ) .. [[Server: WoronaServer Content-Type: text/html Connection: Closed]] if server ~= nil then --: accept an incoming connection creating a client we can use to receive and send data client, err = server:accept() if client ~= nil then worona.log:info("html\_server: found a connection to accept" ) --: receive the data which has been sent to the server message, err = client:receive('\*l') if message ~= nil then local method, uri, protocol = string.match( message, "([A-Z]+) (.+) (.+)" ) local args = getArgs( uri ) worona.log:info("html\_server: received. " .. message ) if args.render ~= nil then worona.log:info( "html\_server: Rendering the internal url '" .. args.render .. "'" ) local html\_Path = system.pathForFile( "content/html/" .. args.render .. ".html", system.CachesDirectory ) local html\_File = io.open( html\_Path, "r" ) local html\_Data = html\_File:read( "\*a" ) html\_File:close() client:send( headers .. html\_Data ) client:close() elseif args.url ~= nil then worona.log:info( "html\_server: We are on iPhone and user clicked on a link with url '" .. args.url .. "'" ) worona:do\_action( "load\_url", args ) end return end else return nil end end worona.log:warning("Something went wrong. Error: " .. err ) end end return html\_server end worona:do\_action( "register\_service", { service = "html\_server", creator = newService } ) local function initialiseServer() worona.log:info( "html\_server: about to start the html server" ) local server, err = worona.html\_server:newServer() if server ~= nil then Runtime:addEventListener( "enterFrame", worona.html\_server:processPetition() ) else worona.log:warning("html\_server: failed to start due to error " .. err ) end end --: start the server local function startHtmlServer() initialiseServer() local function onSystemEvent( event ) if event.type == "applicationResume" then initialiseServer() end end Runtime:addEventListener( "system", onSystemEvent ) end worona:add\_action( "init", startHtmlServer )