Help loading html files into iOs native browser on iPad
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 11
- Joined: Mon Dec 05, 2011 5:33 pm
Help loading html files into iOs native browser on iPad
Hi folks.
I'm hoping someone can enlighten me as to how to properly point to and load local html files, ideally including fancy jquery effects, within an ipad build. I used the standalone settings to add files, first trying a full directory with css and javascript and html, and now just a simple html text file, but I can't seem to wrap my head around how to create a variable that will store a proper path to the file and then have it loaded into the ios native browser. Here's a sample line of code from my onpreOpenCard handler that fails if I try pointing to a local file which I assume is in the "engine" specialFolderPath
iphoneControlSet sBrowserId, "url", "htmltest.html"
I have also tried numerous approaches including code referencing specialFolderPath("engine") to put the path into a variable, and I'm missing something... (Note: I tried posting a sample here and the board won't let me submit it due to lack of permissions)
Anybody have experience using the ios native browser to display locally stored files? Your help and examples would make my day.
Thanks!
I'm hoping someone can enlighten me as to how to properly point to and load local html files, ideally including fancy jquery effects, within an ipad build. I used the standalone settings to add files, first trying a full directory with css and javascript and html, and now just a simple html text file, but I can't seem to wrap my head around how to create a variable that will store a proper path to the file and then have it loaded into the ios native browser. Here's a sample line of code from my onpreOpenCard handler that fails if I try pointing to a local file which I assume is in the "engine" specialFolderPath
iphoneControlSet sBrowserId, "url", "htmltest.html"
I have also tried numerous approaches including code referencing specialFolderPath("engine") to put the path into a variable, and I'm missing something... (Note: I tried posting a sample here and the board won't let me submit it due to lack of permissions)
Anybody have experience using the ios native browser to display locally stored files? Your help and examples would make my day.
Thanks!
Re: Help loading html files into iOs native browser on iPad
Hi w.wartersGA0dc3
I'm not sure, but try this:
...
put "file://" & specialfolderpath("engine") & "/htmltest.html" into tFile
iphoneControlSet sBrowserId, "url",tFile
...
Or three SLASHES after file?
Don't have an iOS license, please try both solutions if one does not work.
Best
Klaus
I'm not sure, but try this:
...
put "file://" & specialfolderpath("engine") & "/htmltest.html" into tFile
iphoneControlSet sBrowserId, "url",tFile
...
Or three SLASHES after file?
Don't have an iOS license, please try both solutions if one does not work.
Best
Klaus
Re: Help loading html files into iOs native browser on iPad
Ah, and welcome to the forum 

-
- Posts: 11
- Joined: Mon Dec 05, 2011 5:33 pm
Re: Help loading html files into iOs native browser on iPad
Thanks for the response Klaus. I was unfortunately unsuccessful using your suggestions. I also tried changing the "file://" part to http with no luck. I wonder, does the iOs browser require parameters to enable local files (or for that matter, javascript)?
-
- Posts: 11
- Joined: Mon Dec 05, 2011 5:33 pm
Re: Help loading html files into iOs native browser on iPad
I came across this mysterious advice and modified it for the Engine special folder and my html file and it worked!
Code: Select all
put (specialFolderPath("Documents") & "/lunch.pdf") into theUrl
replace " " with "%20" in theUrl -- don't ask, just do it
iphoneControlSet browserID, "url", theUrl
Re: Help loading html files into iOs native browser on iPad
Pleased to be of assistance 
Gerry

Gerry
14" MacBook Pro
Former LiveCode developer.
Now recovering.
Former LiveCode developer.
Now recovering.
Re: Help loading html files into iOs native browser on iPad
Hi,
Dixie got me started loading PDF's into the IOS browser with his cool little mapping ap. Taking a look at Gerry's cool little Ap gave me some ideas as well and the little stack he uploaded at the lnk below took me even farther as far as altering HTML on the fly and displaying it in live code.
http://forums.runrev.com/viewtopic.php? ... css#p38382
I am now altering HTML code based on user input and displaying scrolling HTML lists to the user with a couple image links on the far right of each line. These images are dead links (they go no where) their only purpose is to give me feed back via the
on browserLoadRequest pURL command.
In other words I will have two images displayed that contain href links named edit_1234 and delete_1234 (1234 being the unique ID number from the database record and assigned to the HTML through a repeat loop) The command above will return "edit_1234" or "delete_1234" depending on which image is clicked from which line in the scrolling list. I then close the browser out and jump back into live code to alter the SQlite database (to either edit or delete record 1234) and move on. This was easier for me to do than learn how to create scrolling lists with images in a data grid. Gives you a lot of options for text styles etc as well. Lists scroll smoothly which I understand has been an issue in LC. If I get a chance I will upload a sample stack soon.
Thanks to Dixie and Jerry for getting me started.
Dave
Dixie got me started loading PDF's into the IOS browser with his cool little mapping ap. Taking a look at Gerry's cool little Ap gave me some ideas as well and the little stack he uploaded at the lnk below took me even farther as far as altering HTML on the fly and displaying it in live code.
http://forums.runrev.com/viewtopic.php? ... css#p38382
I am now altering HTML code based on user input and displaying scrolling HTML lists to the user with a couple image links on the far right of each line. These images are dead links (they go no where) their only purpose is to give me feed back via the
on browserLoadRequest pURL command.
In other words I will have two images displayed that contain href links named edit_1234 and delete_1234 (1234 being the unique ID number from the database record and assigned to the HTML through a repeat loop) The command above will return "edit_1234" or "delete_1234" depending on which image is clicked from which line in the scrolling list. I then close the browser out and jump back into live code to alter the SQlite database (to either edit or delete record 1234) and move on. This was easier for me to do than learn how to create scrolling lists with images in a data grid. Gives you a lot of options for text styles etc as well. Lists scroll smoothly which I understand has been an issue in LC. If I get a chance I will upload a sample stack soon.
Thanks to Dixie and Jerry for getting me started.
Dave
-
- Posts: 11
- Joined: Mon Dec 05, 2011 5:33 pm
Re: Help loading html files into iOs native browser on iPad
The annoying problem I had with loading local files stored in your app into a browser comes down to a problem with failed url encoding of the file location information. The workaround that people use (and which took me days to discover) requires replacing spaces with %20 programmatically before sending the file link to the browser. Creating a function to handle this repeating problem really makes sense. See this blog post by Obleo for an example.
intkeystrokes.posterous[dot]com/viewing-local-file-in-uiwebview-in-ios-with-l
intkeystrokes.posterous[dot]com/viewing-local-file-in-uiwebview-in-ios-with-l
-
- VIP Livecode Opensource Backer
- Posts: 7
- Joined: Tue Sep 18, 2012 2:43 pm
Re: Help loading html files into iOs native browser on iPad
Hello w.wartersGA0dc3 and LiveCode forum members.
I am new to Live Code and am trying to develop a mobile app that loads local html files into a browser object, but am having a hard time getting started. Could you share a sample of the code or stack that got you over the hump?
Thank you.
Russ
I am new to Live Code and am trying to develop a mobile app that loads local html files into a browser object, but am having a hard time getting started. Could you share a sample of the code or stack that got you over the hump?
Thank you.
Russ
Russell McCabe - Lead Developer
"To the man who only has a hammer, every issue he encounters looks like a nail."
http://goodeggclub.com
"To the man who only has a hammer, every issue he encounters looks like a nail."
http://goodeggclub.com