ChristophMa
ChristophMa

Reputation: 139

Preload JavaScript in UIWebView

So I am currently working on an iPad App (iOS 6) that shows a webpage that is located on my company's intranet. The access from the Internet is achieved via a reverse proxy which works great.

The problem is that this webpage is referencing a JavaScript file that is apprently loaded after the webpage is rendered on the client which results in some jQuery scripts not being run on load time. What works is this:

After this, the javascript code is successfully executed. However the solution is not pretty and results in extended wait times.

Are there any solutions to ensure that all referenced files are loaded before rendering takes place?

Thank you! Christoph

Upvotes: 0

Views: 645

Answers (3)

ChristophMa
ChristophMa

Reputation: 139

The problem was the way I had the UIWebViewer interact with the Reverse Proxy. Getting the HTML code through the proxy without involving my webviewer object resulted in a delayed javascript loading. However, after doing one test connection through the reverse proxy authorization class, I could use this method to load all subsequent webpages w/o any problems: [webView loadRequest:request];

Thanks everyone for your ideas and feedback! Christoph

Upvotes: 0

Joe Hankin
Joe Hankin

Reputation: 960

Look up the UIWebView property that was added in iOS 6 called suppressesIncrementalRendering -- I think that will do exactly what you're looking for.

Upvotes: 0

jsd
jsd

Reputation: 7703

You'll have to fix the webpage so that it doesn't try to run the javascript until the file has actually loaded.

Upvotes: 1

Related Questions