embedding and reading local HTML files in a mobile app

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
goodeggclub
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7
Joined: Tue Sep 18, 2012 2:43 pm

embedding and reading local HTML files in a mobile app

Post by goodeggclub »

Hello,

I don't mean to repost I just didn't get an response to my post in another thread. I'm going to develop a mobile app that loads local html files into a browser object, but am having a hard time getting started. Could anyone share sample code or a stack? I'm new to live code but have been a programmer for years in LAMP systems, so I should catch on fairly well.

Thanks in advance.
Russ
Russell McCabe - Lead Developer

"To the man who only has a hammer, every issue he encounters looks like a nail."

http://goodeggclub.com
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: embedding and reading local HTML files in a mobile app

Post by Klaus »

Hi Russ,

all files/folders that you add in the "Copy files" section of the standalone builder can be found here on your device:
-> specialfolderpath("engine")

So the path to your local HTML files will be something like this:
...
put "file://" & specialfolderpath("engine") & "/index.html") into tURL

## or with a subfolder:
## put "file://" & specialfolderpath("engine") & "/mysite/index.html") into tURL

## In case you have SPACES in your filenames, browser don't like that :-):
replace SPACE with "%20" in tURL

## Create native browser:
mobileControlCreate "browser"

## Set some props:
mobileControlSet "rect","10,10,600,600"
mobileControlSet "visible","true"
mobileControlSet "backgroundcolor","white"

## And finally load the local html file:
mobileControlSet "url", tURL
...

Check this thread:
http://forums.runrev.com/phpBB2/viewtop ... 49&t=11863
and the "iOS Release Notes" -> "Livecode: Menu: Help" for more info


Best

Klaus
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: embedding and reading local HTML files in a mobile app

Post by Klaus »

I forgot: Welcome to the forum :D
goodeggclub
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7
Joined: Tue Sep 18, 2012 2:43 pm

Re: embedding and reading local HTML files in a mobile app

Post by goodeggclub »

Thank you Klaus for the info and the welcome. I will give it a shot here later tonight. Being from the PHP world of programming I'm pretty used to naming files with an underscore instead of a space. I'm just trying to get used to the stack and card system and the scripting language. Your example should get me going. I really appreciate it. Russ
Russell McCabe - Lead Developer

"To the man who only has a hammer, every issue he encounters looks like a nail."

http://goodeggclub.com
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: embedding and reading local HTML files in a mobile app

Post by Klaus »

Hi Russ,

check these stacks to get the "grip" of Livecode:
http://www.runrev.com/developers/lesson ... nferences/


Best

Klaus
Post Reply