iOS Question Page not loading in WebView

Discussion in 'iOS Questions' started by abhishek007p, May 14, 2015.

  1. abhishek007p

    abhishek007p Active Member Licensed User

    Hi,

    i have a simple app which is uses webview to display a html page, in Debug build the html page appears fine but in release build, the webview is blank (white).

    i have already
    -cleaned up safari history in case that was causing problem.
    -placed a test button to reload the page instead of at app start.
    -checked if file exists or not, and it does exists.

    here is the code i am using to load the html page.

    Code:
    WebView1.LoadUrl("file://" & File.Combine(File.DirAssets,"1.htm"))

    placed under
    Sub Application_Start
     
    Last edited: May 14, 2015
  2. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    Hi
    Use LoadHtml
    example :
    Code:
    Webview1.LoadHtml(File.LoadString(File.DirAsset,"1.html"))
     
  3. abhishek007p

    abhishek007p Active Member Licensed User

    LoadHtml is for loading HTML string not a file.
    http://www.b4x.com/b4i/help/views.html#webview

    Loadhtml works but very slow, my html page takes 3-4 secs to appear. dont know how to fix it, i have searched the forum and other are also having this problem.
     
    Last edited: May 14, 2015
  4. Erel

    Erel Administrator Staff Member Licensed User

    LoadHtml just calls the native UIWebView API that loads an html string. Make sure that your string doesn't reference any non-local resources.
     
  5. abhishek007p

    abhishek007p Active Member Licensed User

    my html page has lots of non-english Unicode character and the take time to render if loading by string, but not in case of loading the html by file in debug mode. i am not referencing non-local files, all the images and css are added to the files tab.

    some other user suggested to copy the html to temp folder and then load it, is it fine to do it?

    My page do have two external links, one opens a link and other link is a mailto to send me a email. is it fine?

    Can you post a Obj-C code to load a html file in webview?
     
    Last edited: May 15, 2015
  6. Erel

    Erel Administrator Staff Member Licensed User

    It will not have any impact on the performance.
    It will also won't affect the performance.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice