Can't get local html to load

I suspect its just because I’m not referencing the file correctly.

[lua]

    webView = native.newWebView(0,0 , ccp.core.width, ccp.core.height - 50)

    webView:request(“tandc.html”)

[/lua]

I’m not interested in interacting with the webpage, I just want to show it, there is a button underneath to continue. I’ve dumped the tandc.html in the same directory as my main.lua. When loading, it says that the file cannot be found. I’ve also tried it as a tandc.txt file.

Any suggestions?

Hi @Mourdos,

Please try including the absolute path (system directory) when using “local” HTML content. Let me know if this doesn’t solve the issue.

[lua]

object:request( url, baseDir )

[/lua]

Take care,

Brent

Hey Brent,

I’m not entirely sure what the baseDir is for the file. I just have one directory that holds my project, with sub folders. I’ve always just been able to references the files using “scene.scene1” for a file in a scene sub folder, or “images.brandA.button” for a specific button. I suspect I’ve run into the gotcha with regards to html/htm files on android. I know that if I remove the .html from the file on my local system and load it in chrome, it opens it as a html file, I’ll have to check if the built in browser assumes html unless otherwise specified.

I’ll post back when I know the answer.

Yep, using

webView:request(“tandc”, system.ResourceDirectory) worked.

Cheers.

Hi @Mourdos,

Please try including the absolute path (system directory) when using “local” HTML content. Let me know if this doesn’t solve the issue.

[lua]

object:request( url, baseDir )

[/lua]

Take care,

Brent

Hey Brent,

I’m not entirely sure what the baseDir is for the file. I just have one directory that holds my project, with sub folders. I’ve always just been able to references the files using “scene.scene1” for a file in a scene sub folder, or “images.brandA.button” for a specific button. I suspect I’ve run into the gotcha with regards to html/htm files on android. I know that if I remove the .html from the file on my local system and load it in chrome, it opens it as a html file, I’ll have to check if the built in browser assumes html unless otherwise specified.

I’ll post back when I know the answer.

Yep, using

webView:request(“tandc”, system.ResourceDirectory) worked.

Cheers.