I am not asking how to provide a timeout for Android WebView.
What is a default timeout in Android WebView. For example, if I load URL in WebView and there is no network connectivity, for How long will it wait BY DEFAULT before throwing ERROR_TIMEOUT?
Or there is no default?
For android timeout , if you are using cordova then refer to #king of masses comment.
super.setIntegerProperty("loadUrlTimeoutValue", 60000);
to set the timeout then try to use
super.getIntegerProperty("loadUrlTimeoutValue", 0);
The first argument is the property name and the second is the default value which in this case is 0.
Hope this helps,
Related
I use flutter_inappwebview for fetching the website into the flutter app. I want to save all the resources like JS and CSS file content into the cache from website during webview start and then when I call same website the resources will intercept and inject the cached files into the webview. Is this possible.. If possible then how.. please explain with example. Thank you.
note: caching is already enabled for this plugin by default. but what you're asking is offline-mode which flutter_inappwebview plugin does not support yet.
the cache you're refering to is not the cache that browsers use (mobile or desktop) what you're refering to is basically called offline-mode in the world of browsers.
in regard to the flutter_inappwebview plugin there is already an issue (or two) about this feature you're looking for. and i believe it is not implemented yet.
you should keep an eye on these github issues issue-561 & issue-366
That flutter_inappwebview package has already a property, cacheEnabled with default parameter, true. You don't need to do anything about this. If you don't want to store cache files, then you can set it to false.
///Sets whether WebView should use browser caching. The default value is `true`.
///
///**NOTE**: available on iOS 9.0+.
bool cacheEnabled;
And, the clearCache property with the default value, 'false'.
///Set to `true` to have all the browser's cache cleared before the new WebView is opened. The default value is `false`.
bool clearCache;
Seems like the Bluemix Push Notification service has been subject to changes recently. Indeed, when you click on the Mobile Options button in the configuration panel, a message in the pop up window states that The use of App Route parameter is deprecated.
However, this app route parameter was required when intializing the BMSClient plugin (BMSClient.initialize(BLUEMIX_PUSH_APP_ROUTE, BLUEMIX_PUSH_APP_GUID))
What is the right way to initialize the ibm-mfp-push plugin now that the app route parameter is deprecated?
I know that the ibm-mfp-mush cordova plugin is currently being updated. Will the update address that issue? Is there a status about the release of the updated version of the plugin?
Thanks
So for the time being, continue to use your regular app route (from the MobileFirstServices starter or other).
The new ibm-mfp-push (probably will be renamed bms-push) will address this issue. It is currently in the backlog. The estimated time of completion is about one month from now.
Part 1: Expected behaviour?
I'm seeing some inconsistent browser behaviour between Firefox and Chrome in relation to the onclose handler being called.
It seems that Chrome does not trigger an onclose if it was caused by a user page navigation/refresh. However, Firefox does trigger the onclose.
It seems to me that Firefox may be behaving correctly here:
When the WebSocket connection is closed, possibly cleanly, the user agent must create an event that uses the CloseEvent interface, with the event name close, which does not bubble, is not cancelable, has no default action, whose wasClean attribute is set to true if the connection closed cleanly and false otherwise, whose code attribute is set to the WebSocket connection close code, and whose reason attribute is set to the WebSocket connection close reason; and queue a task to first change the readyState attribute's value to CLOSED (3), and then dispatch the event at the WebSocket object.
Source: http://www.w3.org/TR/2011/WD-websockets-20110419/#closeWebSocket
Even though it can lead to some sneaky code/unexpected behaviour.
Can anybody confirm the expected behaviour?
Part 2: How to implement auto-reconnect?
If you have a library that auto-reconnects for the user how do you know if you should try to reconnect? Do you check the CloseEvent.wasClean property? I'm having to assume that 'clean' means that the close was supposed to happen through either an API call to WebSocket.close() or the server sending a close frame? If a network error causes the close I'm guessing the wasClean would be false?
In the Pusher JavaScript library we assumed (onclose -> waiting -> connecting) that a close should trigger a reconnect unless we are in a closing state - the developer has chosen to close the connection. It would appear that the socket.io client library makes the same assumption.
Based on this the Firefox onclose event caused by user navigation/refresh triggers an unwanted reconnection because neither library check the CloseEvent.wasClean property.
Example and Video
Here's an example that you can use to demonstrate the inconsistency:
http://jsbin.com/awonod/7
Here's a video of me demonstrating the problem:
http://www.screenr.com/vHn8
(it's late, ignore the couple of slip-ups :))
One point to note is that my hitting the Escape key could also be causing the WebSocket connection to close. However, if you watch closely or try for yourself you will see the close event being logged just before the page refreshes.
The unexpected behavior is due to the way in which Firefox and Chrome handle the closing of a Websocket. When the page is refreshed, both browsers close the connection, however, Firefox will execute your onclose code, while chrome closes the connection and skips straight to re-loading the new page. So yes, I confirm this strange behavior.
Even stranger is the fact that, from my observations, calling websocket.close() in chrome will immediately close the connection and call the onclose function, while Firefox waits for a close message back from the server.
The wasClean property will be true if a close message was received from the server
If your library is auto-reconnecting without checking the wasClean property then this could cause a problem, as it tries to re-establish the connection as the page refreshes. You should consider not using the library for this and doing it manually, it should'nt be very hard, just call connect in the onclose function with an if statement making sure the onclean property is true. Or to be even more safe set a variable in onbeforeunload that prevents any new connection.
hope this helps!
This is amazingly still the current behavior in 2022. You can demonstrate this trivially by adding a console log in an onclose handler for a websocket, and click a link in Firefox vs in Chrome while watching the console (ensuring you preserve the console between webpages):
ws.onclose = function(e) {
printMsg('CLOSE')
// ... my other code ...
}
Firefox will show you a 'CLOSE' and Chrome will not.
I am trying to download a file from server. The normal GWT RPC call doesnot allow me to do that, and hence I wrote a servlet to do that job for me. From the client side, I am creating a Frame object, and I set the servlet URL in it, and add that frame Object in my root panel.
When I execute this in IE, a window pops up asking for Save/Open file.
But when I execute the same in a Firefox or a Google Chrome browser, nothing is happing.
I am not getting any request on my servlet/server side.
Here is a slice of the code :-
String servletUrl = "http://localhost:13080/Browser/ui/dataExportServlet?level=ZERO";
Frame frame = new Frame(servletUrl);
frame.setVisible(false);
RootPanel.get().add(frame);
So, can someone please help me out.
This might be related to same origin policy.
Are both servlet and webapp running on port 13080?
If they differ, SOP might fail this.
If I understand correctly, IE has a more relaxed policy so it might work there but not in chrome.
See http://en.wikipedia.org/wiki/Same_origin_policy and Can I disable SOP (Same Origin Policy) on any browser for development?
In Chrome, you can use the Developer Tools (CTRL + SHIFT + I) to check if the IFrame is being added to the HTML, and if the frame's source is being set properly. You should also be able to see what content has been loaded into the iframe.
Alternately, set a breakpoint in your servlet to see if the iframe is being hit at all from Chrome.
I got the solution for this issue.
I removed the frames and added the following code :-
com.google.gwt.user.client.Window.open(url, "CSVDownload", "");
Now, this opens a new browser window, and then I get the pop-up to open/save the server side file in all 3 web-browsers. (IE, Mozilla FireFox, Chrome).
Thanks a lot!!!
I'm developing an iPhone re-dialer application in which a number is dialed and if the call is waiting then it will once again redial. But my application is exiting when number is dialed. I don't want that, it should automatically return.
Can somebody help me in solving the problem?
Thanks in Advance.
No, this is not possible. You should save your application state when the call is received, so that the user can pick up where he or she left off in your application, after taking the call.
Create a ‘UIWebView‘ that's hidden and use it load a ‘tel:‘ URL request. It will prompt you to make the call but when the call finishes you'll be returned to your app.
File a bug though to make it proper API though.
The Solution which Ashley suggested works well.
I tried it and the control returns back to the app after call is disconnected.
Also using a webView one can use letter like 1-800-CallUS, etc for dialing.
Declare a webview, create a html file with phone# as a link(this link is automatically detected in your app) and import the file in resources and load the html in a string variable , add this subview to your main view.