PotatoEngineer
PotatoEngineer

Reputation: 1642

CordovaWebView.loadUrl is timing out on a javascript: URL

I have an Android application that contains several CordovaWebViews. (Note: I'm doing maintenance on an app that's largely unfamiliar to me.) The various WebViews send messages to each other using the loadUrl function in CordovaWebView, with a string of "javascript: ('toggleMenu();');". (The toggleMenu() function is in one of my

I made some changes to the way the WebViews are laid out (added another top-level view that holds both a slide-out menu and the main view), and suddenly these loadUrl calls are timing out: I get the dread "E/CordovaWebView(2774): CordovaWebView: TIMEOUT ERROR!" line showing up in the logcat.

How can this be happening, since the URL I'm loading is a tiny, tiny JavaScript snippet? Where should I look for the cause of this error? The logcat isn't terribly helpful, aside from informing me that the call was correctly send up to the Android WebView instance:

D/NWCPanels(2774): <9956> sendMessage - HEADER; target: main
D/NWCPanels(2774): <9956> sendMessage - script:javascript:  ('toggleMenu();');
D/UiTask(2774): <1> run - url: javascript:  ('toggleMenu();');
D/WebView(2774): loadUrlImpl: called

Okay, the call got all the way to Android's WebView. There's my debug statement to show that my code thinks it worked, and then it looks like it's actually hitting webkit:

D/CordovaLog(2774): - Debug - toggleMenu from header. result: true
D/webcore(2774):  CORE loadUrl: called
D/webkit(2774): Firewall not null
D/webkit(2774): euler: isUrlBlocked = false

Maybe it's thinking about loading my URL, since it's not blocked? But then , ~3 seconds later:

E/CordovaWebView(2774): CordovaWebView: TIMEOUT ERROR!

Upvotes: 0

Views: 1838

Answers (2)

Patel vaishu
Patel vaishu

Reputation: 156

please clear webview catch using webView.Clearcatch() it works fine. I have tried same and it solved my problem.

Upvotes: 2

PotatoEngineer
PotatoEngineer

Reputation: 1642

It turned out to be something I didn't mention in the question at all: the in-house framework I was using didn't like the way I formatted my functions. (It does string-manipulation to figure out the name of a function, and doing "var funcName = function(){}" breaks it.)

Nothing to see here folks, move along...

Upvotes: 0

Related Questions