Browser widget with included folder

Getting into LiveCode for iOS? Ask your questions here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
Batninja
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 55
Joined: Sat Oct 15, 2011 9:43 am

Browser widget with included folder

Post by Batninja » Tue Aug 25, 2020 8:53 pm

Hello

Has anyone managed to get a folder with HTML files included into an IOS app and accessed with the browser widget?

I have included a folder called "iac" in the standalone settings that has an idex.html file and other content. It works fine with a direct path to the index.html file on my local drive in the browser widget URL but I cannot get the IOS app to find the included version.

The code I'm using is

Code: Select all

on mouseUp
   put "file://" & specialfolderpath("engine") & "/iac/index.html" into file1
   set the url of widget "Browser" to file1
end mouseUp
I've tried with/without file: and various combinations of slashes without any luck.

Any help would be appreciated. :-)
Last edited by Batninja on Fri Aug 28, 2020 10:00 am, edited 1 time in total.

simon.schvartzman
Posts: 486
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: Browser widget with included folder

Post by simon.schvartzman » Wed Aug 26, 2020 11:28 am

HI, I guess the specialfolderpath has to be "documents" instead of "engine" when deploying to iOS/mobile.

HTH

Best
Simon
________________________________________
To ";" or not to ";" that is the question

Klaus
Posts: 12286
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Browser widget with included folder

Post by Klaus » Thu Aug 27, 2020 4:06 pm

Get used to use -> specialfolderpath("resources")
That happens to be the same as -> specialfolderpath("engine")
on iOS, but only on iOS and Android!

Try this, and please use the CODE tags after pasting your LC script(s) here:

Code: Select all

on mouseUp
  put "file://" & specialfolderpath("resources") & "/iac/index.html" into file1

  ## We have to avoid SPACES in the pathname for URLs:
  replace " " with "%20" in file1
  set the url of widget "Browser" to file1
  
  ## Check for success and maybe get a hint why it failed if it did:
  if the result <> EMPTY then
     answer "Error:" & CR & the result
  end if
end mouseUp

Batninja
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 55
Joined: Sat Oct 15, 2011 9:43 am

Re: Browser widget with included folder

Post by Batninja » Fri Aug 28, 2020 10:26 am

Thank so much Klaus for helping out with our code sample, it worked perfectly and runs fine on my iPhone 6s.

Thanks as well for the code tags advice, I fixed my original post :)

Post Reply

Return to “iOS Deployment”