Page 1 of 1
Load HTML file within the app
Posted: Sat May 03, 2014 12:45 pm
by michel_bujardet
I am trying to open an HTML file stored in my app instead of an URL.
I added index.html in the Copy Files section of the Standalone Applications settings and have modified the initial url of the browser lesson to :
Code: Select all
mobileControlSet sBrowserId, "url", "file:" & specialFolderPath("engine") & "/index.html"
Nothing displays. I tried file:// as well, no luck. What am I missing ?
Thank you.
Re: Load HTML file within the app
Posted: Sat May 03, 2014 12:56 pm
by Dixie
Store the html file in a custom property... then when the stack opens move the custom property into a file... as in
Code: Select all
/*put the custom property cMap into a file 'dvNav.html' in the documents folder */
put the cMap of this stack into URL("file:" & specialFolderPath("documents") & "/dvnav.html" )
Then when you want to build your browser
Code: Select all
if browserID is empty then
put "file://" & specialFolderPath("documents") & "/dvnav.html" into theURL
replace space with "%20" in theURL
put 0,44, the width of this card, the height of this card into theSize
mobileControlCreate "browser"
put the result into browserID
mobileControlSet browserID, "url", theURL
mobileControlSet browserID, "rect", theSize
mobileControlSet browserID, "autofit",true
mobileControlSet browserID, "delayRequests", true
mobileControlSet browserID, "dataDetectorTypes", "link, calendar event, phone number, address"
mobileControlSet browserID, "visible", "true"
end if
Attached a stack that will display a 'google map' when you run in the simulator. Look in the custom properties of the stack and you will see the html file...
Hope it helps...

Re: Load HTML file within the app
Posted: Sat May 03, 2014 7:55 pm
by michel_bujardet
Dixie wrote:Store the html file in a custom property... then when the stack opens move the custom property into a file... as in
Dear Dixie,
I slightly modified your code, and it now works beautifully :
Code: Select all
put "file://" & specialFolderPath("engine") & "/index.html" into theURL
replace space with "%20" in theURL
put 10,0, the width of this card-20, the height of this card-50 into theSize
mobileControlCreate "browser"
put the result into browserID
mobileControlSet browserID, "url", theURL
mobileControlSet browserID, "rect", theSize
mobileControlSet browserID, "autofit",true
mobileControlSet browserID, "delayRequests", true
mobileControlSet browserID, "dataDetectorTypes", "link, calendar event, phone number, address"
mobileControlSet browserID, "visible", "true"
Thank you so much !
