NullPointerException
NullPointerException

Reputation: 37579

WebView: Differences between LoadUrl() and LoadDataWithBaseURL()

I want to load a remote url that haves an ad. The ad will use JavaScript.

I am using:

webview.loadUrl("http://myurl.com")
webview.getSettings().setJavaScriptEnabled(true);

Which differences will exists if I use:

webview.loadDataWithBaseURL("http://myurl.com", null, null, null, null)
webview.getSettings().setJavaScriptEnabled(true);

Thanks

Upvotes: 3

Views: 5351

Answers (1)

Ankit Kumar
Ankit Kumar

Reputation: 3723

LoadDataWithBaseURL() - Loads the given data into this WebView, using baseUrl as the base URL for the content. The base URL is used both to resolve relative URLs and when applying JavaScript's same origin policy. The historyUrl is used for the history entry. ....

LoadUrl() - Loads the given URL with the specified additional HTTP headers.

See documentation - http://developer.android.com/reference/android/webkit/WebView.html

Upvotes: 1

Related Questions