Javascript - The URL can't be shown

Hi all,

i’ve a little trouble with javascript and corona.

i’ve made a component for google maps ad markers but, when i click over the links, iOS returns: Error The URL can’t be shown.

in js side:

marker.html = '\<form action=\"controller:mycommand\"\>\<input type=\"submit\"/ value=\"'pippo'\" \>\</form\>';

in LUA side:

local function webListener( event ) &nbsp; &nbsp; if event.url then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if 1 == string.find( event.url, "controller:" ) then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; local url = string.gsub(event.url, "controller:", "") &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; composer.removeScene("scheda") &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; composer.gotoScene("scheda","slideLeft", 250) &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; end &nbsp; &nbsp; if event.type then &nbsp; &nbsp; &nbsp; &nbsp; if event.type~="loaded" and event.type~="other" then end &nbsp; &nbsp; end &nbsp; &nbsp; if event.errorCode then &nbsp; &nbsp; &nbsp; &nbsp; native.showAlert( "Error!", event.errorMessage, { "OK" } ) &nbsp; &nbsp; end end

webView = native.newWebView( 160, 240, 320, 480 )

webView:addEventListener(“urlRequest”, webListener)

webView:request( “map.html”, system.DocumentsDirectory )

_page:insert(webView)

can you help me?

Regards,

P.s. Sorry for my bad english.

can you help me please? :frowning:

webView:request( “map.html”, system.DocumentsDirectory ) is trying to load a file called map.html, but at the top you mention “marker.html”.

Could this be the source of your error?
 

Rob

mmh… no (i think)

This is the full source:

googlemap.lua (loaded form mappe.lua)

do local M={} -- GOOGLE MAP da ottimizzare e trasformare in modulo local path = system.pathForFile( "map.html", system.DocumentsDirectory ) function M.renderMap(sites) local sitesString = table.concat(sites) --print(sitesString) local centerMaps={} centerMaps[1]=44.647128 centerMaps[2]=10.925226899999984 local markersRender={} for i=0,4 do markersRender[i]=[[&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var sites = markers[]]..i..[[]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var siteLatLng = new google.maps.LatLng(sites[1], sites[2]); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var marker = new google.maps.Marker({ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; position: siteLatLng, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map: map, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; title: sites[0], &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; url\_page: sites[5], &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zIndex: sites[3], &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; html: sites[4] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }); marker.html = '\<form action=\"corona:'+sites[6]+'\"\>\<input type=\"submit\"/ value=\"'+sites[0]+'\" \>\</form\>'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; google.maps.event.addListener(marker, "click", function () { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //window.open("OPEN:"+this.title); //document.location.href = "" &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //infowindow.setContent(this.html); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //infowindow.open(map, this); &nbsp; &nbsp; &nbsp; &nbsp; infoBubble.setContent(this.html); &nbsp; &nbsp; &nbsp; &nbsp; infoBubble.open(map, this); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }); ]] end local markerString = table.concat(markersRender) --print(markerString) --HTML & JAVASCRIPT CODE local mapString=[[\<!DOCTYPE html\> \<html\> &nbsp; &nbsp;\<head\> &nbsp; &nbsp; &nbsp; &nbsp;\<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /\> &nbsp; &nbsp; &nbsp; &nbsp;\<style type="text/css"\> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;html { height: 100% } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;body { height: 100%; margin: 0; padding: 0 } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#map\_canvas { height: 100% } &nbsp; &nbsp; &nbsp; &nbsp;\</style\> &nbsp; &nbsp; &nbsp; &nbsp;\<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?&sensor=true&language="\> \</script\> \<script type="text/javascript" src="https://raw.githubusercontent.com/googlemaps/js-info-bubble/gh-pages/src/infobubble.js"\> \</script\> &nbsp; &nbsp; &nbsp; &nbsp;\<script type="text/javascript"\> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;function initialize() { &nbsp; &nbsp; var sites = [ &nbsp; &nbsp; &nbsp; &nbsp;]]..sitesString..[[&nbsp; &nbsp;]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var myOptions = { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;center: new google.maps.LatLng(]]..centerMaps[1]..[[,]]..centerMaps[2]..[[), &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;zoom: 12, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;disableDoubleClickZoom: true, scrollwheel: true, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;draggable: true, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;disableDefaultUI: true, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;zoomControl: true, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mapTypeId: google.maps.MapTypeId.ROADMAP &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var map = new google.maps.Map(document.getElementById("map\_canvas"), myOptions); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;setMarkers(map, sites); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var prev\_infowindow = true;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//Custom Vars for controlling certain aspects &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var allowStyling = false; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var bouncingPins = false; &nbsp; &nbsp; function setMarkers(map, markers) { &nbsp; &nbsp; &nbsp; &nbsp;infoBubble = new InfoBubble({ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; maxWidth: 300 &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp; infoBubble = new InfoBubble({ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map: map, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; content: '', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadowStyle: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; padding: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; backgroundColor: 'rgb(57,57,57)', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; borderRadius: 4, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arrowSize: 10, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; borderWidth: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; borderColor: '#2c2c2c', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; disableAutoPan: true, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hideCloseButton: true, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arrowPosition: 30, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; backgroundClassName: 'phoney', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arrowStyle: 2 &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp;]]..markerString..[[&nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp; &nbsp; &nbsp;\</script\> &nbsp; &nbsp;\</head\> &nbsp; &nbsp;\<body onload="initialize()"\> &nbsp; &nbsp; \<div id="map\_canvas" style="width:100%; height:100%"\>\</div\> &nbsp; &nbsp; \<iframe id="l" width="1" height="1" style="visibility:hidden"\>\</iframe\> &nbsp; &nbsp;\</body\> \</html\>]] &nbsp; &nbsp; --HTML FILE CREATION &nbsp; &nbsp; local file = io.open( path, "w" ) &nbsp; &nbsp; file:write( mapString ) &nbsp; &nbsp; io.close( file ) end return M end

and  mappe.lua 

do &nbsp; &nbsp; local composer = require("composer") &nbsp; &nbsp; local scene = composer.newScene() &nbsp; &nbsp; local widget = require("widget") &nbsp; &nbsp; local http = require("socket.http") &nbsp; &nbsp; local url = require("socket.url") &nbsp; &nbsp; local json = require "json" &nbsp; &nbsp; local navbarScript = require("navbar") &nbsp; &nbsp; local response = http.request("https://www.quiboapp.com/json/map\_locals.php") &nbsp; &nbsp; local \_page=display.newGroup() &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; local pageName=composer.getVariable("title") &nbsp; &nbsp; print("Loaded... Title: "..pageName) &nbsp; &nbsp; local backgroundView = require("background") &nbsp; &nbsp; local \_page=display.newGroup() &nbsp; &nbsp; \_page:insert(backgroundView.image("background.png")) &nbsp; &nbsp; \_page:insert(navbarScript.renderNavBar("menu")) &nbsp; &nbsp; local googleMaps = require("googlemap") &nbsp; &nbsp; local templateScehda = require("template") &nbsp; &nbsp; local webView &nbsp; &nbsp; local decoded, pos, msg = json.decode( response ) &nbsp; &nbsp; if not decoded then &nbsp; &nbsp; &nbsp;print( "Decode failed at "..tostring(pos)..": "..tostring(msg) ) &nbsp; &nbsp; end -- "scene:create()" function scene:create( event ) &nbsp; &nbsp; local sceneGroup = self.view &nbsp; &nbsp; -- Initialize the scene here. &nbsp; &nbsp; -- Example: add display objects to "sceneGroup", add touch listeners, etc. end -- GOOGLE MAP da ottimizzare e trasformare in modulo local sites={} for m=1,#decoded do &nbsp; &nbsp; sites[m]=[[&nbsp; &nbsp; &nbsp; &nbsp; [']]..decoded[m].locale\_nome..[[',']]..decoded[m].lat..[[',']]..decoded[m].lng..[[','1',']]..decoded[m].locale\_nome..[[',']]..decoded[m].url\_page..[[',']]..decoded[m].locale\_id..[['], &nbsp; &nbsp; ]] end googleMaps.renderMap(sites) local function webListener( event ) &nbsp; &nbsp; if event.url then &nbsp; &nbsp; &nbsp; &nbsp; print( "You are visiting: " .. event.url ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if 1 == string.find( event.url, "corona:" ) then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; local url = string.gsub(event.url, "corona:", "") &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(url) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --composer.setVariable("title","scheda") &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; composer.removeScene("scheda") &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; composer.gotoScene("scheda","slideLeft", 250) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --showMarkerInfo( url ) &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; end &nbsp; &nbsp; if event.type then &nbsp; &nbsp; &nbsp; &nbsp; if event.type~="loaded" and event.type~="other" then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --local webView = require("webViewController") &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --local ww=webView.controller("https://www.quiboapp.com/json/wv\_dove\_mangiato.php?user\_id=2077",160,240,320,480) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --\_page:insert(ww) &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; &nbsp; &nbsp; print( "The event.type is " .. event.type ) -- print the type of request &nbsp; &nbsp; end &nbsp; &nbsp; if event.errorCode then &nbsp; &nbsp; &nbsp; &nbsp; native.showAlert( "Error!", event.errorMessage, { "OK" } ) &nbsp; &nbsp; end end function scene:show( event ) &nbsp; &nbsp; local sceneGroup = self.view &nbsp; &nbsp; local phase = event.phase &nbsp; &nbsp; if ( phase == "will" ) then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sceneGroup:insert(\_page) &nbsp; &nbsp; elseif ( phase == "did" ) then &nbsp; &nbsp; &nbsp; &nbsp; native.setActivityIndicator( false )&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; webView = native.newWebView( 160, 240, 320, 480 ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; webView:addEventListener("urlRequest", webListener) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; webView:request( "map.html", system.DocumentsDirectory ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \_page:insert(webView) &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -- Called when the scene is now on screen. &nbsp; &nbsp; &nbsp; &nbsp; -- Insert code here to make the scene come alive. &nbsp; &nbsp; &nbsp; &nbsp; -- Example: start timers, begin animation, play audio, etc. &nbsp; &nbsp; end end -- "scene:hide()" function scene:hide( event ) &nbsp; &nbsp; local sceneGroup = self.view &nbsp; &nbsp; local phase = event.phase &nbsp; &nbsp; if ( phase == "will" ) then &nbsp; &nbsp; &nbsp; &nbsp; if webView and webView.removeSelf then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; webView:removeSelf() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; webView = nil &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; &nbsp; &nbsp; -- composer.removeScene(pageName) &nbsp; &nbsp; &nbsp; &nbsp; -- Called when the scene is on screen (but is about to go off screen). &nbsp; &nbsp; &nbsp; &nbsp; -- Insert code here to "pause" the scene. &nbsp; &nbsp; &nbsp; &nbsp; -- Example: stop timers, stop animation, stop audio, etc. &nbsp; &nbsp; elseif ( phase == "did" ) then &nbsp; &nbsp; &nbsp; &nbsp; composer.removeScene(pageName) &nbsp; &nbsp; &nbsp; &nbsp; -- Called immediately after scene goes off screen. &nbsp; &nbsp; end end -- "scene:destroy()" function scene:destroy( event ) &nbsp; &nbsp; local sceneGroup = self.view &nbsp; &nbsp; &nbsp; &nbsp; for i=1,self.view.numChildren do &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; local c = self.view[i] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c:removeSelf() &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; &nbsp; &nbsp; package.loaded["background"] = nil &nbsp; &nbsp; &nbsp; &nbsp; package.loaded["navbar"] = nil &nbsp; &nbsp; &nbsp; &nbsp; package.loaded["webViewController"] = nil &nbsp; &nbsp; &nbsp; &nbsp; package.loaded["webView"] = nil &nbsp; &nbsp; -- Called prior to the removal of scene's view ("sceneGroup"). &nbsp; &nbsp; -- Insert code here to clean up the scene. &nbsp; &nbsp; -- Example: remove display objects, save state, etc. end -- ------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) &nbsp; &nbsp; return scene end

thanks in advance for your help.

any help? :frowning:

I would suggest examining the actual HTML that’s output. Since you can test this (on OS X at least) in the simulator, you should be able to go find the actual HTML that’s being output and try running it in web browser and look for errors. Firebug (if you’re using Firefox as a browser) is really good about reporting Javascript errors.

Rob

 no errors found :confused:
can how i help you, for help me :slight_smile:

grazie!

Perhaps post the rendered HTML?

can you help me please? :frowning:

webView:request( “map.html”, system.DocumentsDirectory ) is trying to load a file called map.html, but at the top you mention “marker.html”.

Could this be the source of your error?
 

Rob

mmh… no (i think)

This is the full source:

googlemap.lua (loaded form mappe.lua)

do local M={} -- GOOGLE MAP da ottimizzare e trasformare in modulo local path = system.pathForFile( "map.html", system.DocumentsDirectory ) function M.renderMap(sites) local sitesString = table.concat(sites) --print(sitesString) local centerMaps={} centerMaps[1]=44.647128 centerMaps[2]=10.925226899999984 local markersRender={} for i=0,4 do markersRender[i]=[[&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var sites = markers[]]..i..[[]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var siteLatLng = new google.maps.LatLng(sites[1], sites[2]); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var marker = new google.maps.Marker({ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; position: siteLatLng, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map: map, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; title: sites[0], &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; url\_page: sites[5], &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zIndex: sites[3], &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; html: sites[4] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }); marker.html = '\<form action=\"corona:'+sites[6]+'\"\>\<input type=\"submit\"/ value=\"'+sites[0]+'\" \>\</form\>'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; google.maps.event.addListener(marker, "click", function () { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //window.open("OPEN:"+this.title); //document.location.href = "" &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //infowindow.setContent(this.html); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //infowindow.open(map, this); &nbsp; &nbsp; &nbsp; &nbsp; infoBubble.setContent(this.html); &nbsp; &nbsp; &nbsp; &nbsp; infoBubble.open(map, this); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }); ]] end local markerString = table.concat(markersRender) --print(markerString) --HTML & JAVASCRIPT CODE local mapString=[[\<!DOCTYPE html\> \<html\> &nbsp; &nbsp;\<head\> &nbsp; &nbsp; &nbsp; &nbsp;\<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /\> &nbsp; &nbsp; &nbsp; &nbsp;\<style type="text/css"\> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;html { height: 100% } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;body { height: 100%; margin: 0; padding: 0 } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#map\_canvas { height: 100% } &nbsp; &nbsp; &nbsp; &nbsp;\</style\> &nbsp; &nbsp; &nbsp; &nbsp;\<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?&sensor=true&language="\> \</script\> \<script type="text/javascript" src="https://raw.githubusercontent.com/googlemaps/js-info-bubble/gh-pages/src/infobubble.js"\> \</script\> &nbsp; &nbsp; &nbsp; &nbsp;\<script type="text/javascript"\> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;function initialize() { &nbsp; &nbsp; var sites = [ &nbsp; &nbsp; &nbsp; &nbsp;]]..sitesString..[[&nbsp; &nbsp;]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var myOptions = { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;center: new google.maps.LatLng(]]..centerMaps[1]..[[,]]..centerMaps[2]..[[), &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;zoom: 12, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;disableDoubleClickZoom: true, scrollwheel: true, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;draggable: true, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;disableDefaultUI: true, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;zoomControl: true, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mapTypeId: google.maps.MapTypeId.ROADMAP &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var map = new google.maps.Map(document.getElementById("map\_canvas"), myOptions); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;setMarkers(map, sites); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var prev\_infowindow = true;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//Custom Vars for controlling certain aspects &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var allowStyling = false; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var bouncingPins = false; &nbsp; &nbsp; function setMarkers(map, markers) { &nbsp; &nbsp; &nbsp; &nbsp;infoBubble = new InfoBubble({ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; maxWidth: 300 &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp; infoBubble = new InfoBubble({ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map: map, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; content: '', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shadowStyle: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; padding: 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; backgroundColor: 'rgb(57,57,57)', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; borderRadius: 4, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arrowSize: 10, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; borderWidth: 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; borderColor: '#2c2c2c', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; disableAutoPan: true, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hideCloseButton: true, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arrowPosition: 30, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; backgroundClassName: 'phoney', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arrowStyle: 2 &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp;]]..markerString..[[&nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp; &nbsp; &nbsp;\</script\> &nbsp; &nbsp;\</head\> &nbsp; &nbsp;\<body onload="initialize()"\> &nbsp; &nbsp; \<div id="map\_canvas" style="width:100%; height:100%"\>\</div\> &nbsp; &nbsp; \<iframe id="l" width="1" height="1" style="visibility:hidden"\>\</iframe\> &nbsp; &nbsp;\</body\> \</html\>]] &nbsp; &nbsp; --HTML FILE CREATION &nbsp; &nbsp; local file = io.open( path, "w" ) &nbsp; &nbsp; file:write( mapString ) &nbsp; &nbsp; io.close( file ) end return M end

and  mappe.lua 

do &nbsp; &nbsp; local composer = require("composer") &nbsp; &nbsp; local scene = composer.newScene() &nbsp; &nbsp; local widget = require("widget") &nbsp; &nbsp; local http = require("socket.http") &nbsp; &nbsp; local url = require("socket.url") &nbsp; &nbsp; local json = require "json" &nbsp; &nbsp; local navbarScript = require("navbar") &nbsp; &nbsp; local response = http.request("https://www.quiboapp.com/json/map\_locals.php") &nbsp; &nbsp; local \_page=display.newGroup() &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; local pageName=composer.getVariable("title") &nbsp; &nbsp; print("Loaded... Title: "..pageName) &nbsp; &nbsp; local backgroundView = require("background") &nbsp; &nbsp; local \_page=display.newGroup() &nbsp; &nbsp; \_page:insert(backgroundView.image("background.png")) &nbsp; &nbsp; \_page:insert(navbarScript.renderNavBar("menu")) &nbsp; &nbsp; local googleMaps = require("googlemap") &nbsp; &nbsp; local templateScehda = require("template") &nbsp; &nbsp; local webView &nbsp; &nbsp; local decoded, pos, msg = json.decode( response ) &nbsp; &nbsp; if not decoded then &nbsp; &nbsp; &nbsp;print( "Decode failed at "..tostring(pos)..": "..tostring(msg) ) &nbsp; &nbsp; end -- "scene:create()" function scene:create( event ) &nbsp; &nbsp; local sceneGroup = self.view &nbsp; &nbsp; -- Initialize the scene here. &nbsp; &nbsp; -- Example: add display objects to "sceneGroup", add touch listeners, etc. end -- GOOGLE MAP da ottimizzare e trasformare in modulo local sites={} for m=1,#decoded do &nbsp; &nbsp; sites[m]=[[&nbsp; &nbsp; &nbsp; &nbsp; [']]..decoded[m].locale\_nome..[[',']]..decoded[m].lat..[[',']]..decoded[m].lng..[[','1',']]..decoded[m].locale\_nome..[[',']]..decoded[m].url\_page..[[',']]..decoded[m].locale\_id..[['], &nbsp; &nbsp; ]] end googleMaps.renderMap(sites) local function webListener( event ) &nbsp; &nbsp; if event.url then &nbsp; &nbsp; &nbsp; &nbsp; print( "You are visiting: " .. event.url ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if 1 == string.find( event.url, "corona:" ) then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; local url = string.gsub(event.url, "corona:", "") &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(url) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --composer.setVariable("title","scheda") &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; composer.removeScene("scheda") &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; composer.gotoScene("scheda","slideLeft", 250) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --showMarkerInfo( url ) &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; end &nbsp; &nbsp; if event.type then &nbsp; &nbsp; &nbsp; &nbsp; if event.type~="loaded" and event.type~="other" then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --local webView = require("webViewController") &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --local ww=webView.controller("https://www.quiboapp.com/json/wv\_dove\_mangiato.php?user\_id=2077",160,240,320,480) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --\_page:insert(ww) &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; &nbsp; &nbsp; print( "The event.type is " .. event.type ) -- print the type of request &nbsp; &nbsp; end &nbsp; &nbsp; if event.errorCode then &nbsp; &nbsp; &nbsp; &nbsp; native.showAlert( "Error!", event.errorMessage, { "OK" } ) &nbsp; &nbsp; end end function scene:show( event ) &nbsp; &nbsp; local sceneGroup = self.view &nbsp; &nbsp; local phase = event.phase &nbsp; &nbsp; if ( phase == "will" ) then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sceneGroup:insert(\_page) &nbsp; &nbsp; elseif ( phase == "did" ) then &nbsp; &nbsp; &nbsp; &nbsp; native.setActivityIndicator( false )&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; webView = native.newWebView( 160, 240, 320, 480 ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; webView:addEventListener("urlRequest", webListener) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; webView:request( "map.html", system.DocumentsDirectory ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \_page:insert(webView) &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -- Called when the scene is now on screen. &nbsp; &nbsp; &nbsp; &nbsp; -- Insert code here to make the scene come alive. &nbsp; &nbsp; &nbsp; &nbsp; -- Example: start timers, begin animation, play audio, etc. &nbsp; &nbsp; end end -- "scene:hide()" function scene:hide( event ) &nbsp; &nbsp; local sceneGroup = self.view &nbsp; &nbsp; local phase = event.phase &nbsp; &nbsp; if ( phase == "will" ) then &nbsp; &nbsp; &nbsp; &nbsp; if webView and webView.removeSelf then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; webView:removeSelf() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; webView = nil &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; &nbsp; &nbsp; -- composer.removeScene(pageName) &nbsp; &nbsp; &nbsp; &nbsp; -- Called when the scene is on screen (but is about to go off screen). &nbsp; &nbsp; &nbsp; &nbsp; -- Insert code here to "pause" the scene. &nbsp; &nbsp; &nbsp; &nbsp; -- Example: stop timers, stop animation, stop audio, etc. &nbsp; &nbsp; elseif ( phase == "did" ) then &nbsp; &nbsp; &nbsp; &nbsp; composer.removeScene(pageName) &nbsp; &nbsp; &nbsp; &nbsp; -- Called immediately after scene goes off screen. &nbsp; &nbsp; end end -- "scene:destroy()" function scene:destroy( event ) &nbsp; &nbsp; local sceneGroup = self.view &nbsp; &nbsp; &nbsp; &nbsp; for i=1,self.view.numChildren do &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; local c = self.view[i] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c:removeSelf() &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; &nbsp; &nbsp; package.loaded["background"] = nil &nbsp; &nbsp; &nbsp; &nbsp; package.loaded["navbar"] = nil &nbsp; &nbsp; &nbsp; &nbsp; package.loaded["webViewController"] = nil &nbsp; &nbsp; &nbsp; &nbsp; package.loaded["webView"] = nil &nbsp; &nbsp; -- Called prior to the removal of scene's view ("sceneGroup"). &nbsp; &nbsp; -- Insert code here to clean up the scene. &nbsp; &nbsp; -- Example: remove display objects, save state, etc. end -- ------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) &nbsp; &nbsp; return scene end

thanks in advance for your help.

any help? :frowning:

I would suggest examining the actual HTML that’s output. Since you can test this (on OS X at least) in the simulator, you should be able to go find the actual HTML that’s being output and try running it in web browser and look for errors. Firebug (if you’re using Firefox as a browser) is really good about reporting Javascript errors.

Rob

 no errors found :confused:
can how i help you, for help me :slight_smile:

grazie!

Perhaps post the rendered HTML?