Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27692] iOS: JQuery .unload function not working in WebView

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionInvalid
Resolution Date2020-01-02T16:00:02.000+0000
Affected Version/sRelease 8.3.0
Fix Version/sn/a
Componentsn/a
LabelsengTriage
ReporterRiduanul Islam
AssigneeUnknown
Created2019-12-17T19:02:01.000+0000
Updated2020-01-02T16:00:02.000+0000

Description

Client has a webview component where they are running a page with some jQuery and javascript, they have noticed a discrepancy with iOS and android in that the unload function does not work for iOS webview.
$(window).unload(function () {
chat.server.send('[SYSTEM]', $('#displayname').val() + ' has left', $('#operatorid').val(), $('#convoID').val());
});
This is the specific jQuery line they're using. They basically have a webview where the URL points to a page that's using javascript and jquery and they want code to run in the .unload function. it's not running for iOS webview but work for android.

Comments

  1. Ewan Harris 2019-12-18

    [~rislam] could they provide a full sample showing their issue, the jquery snippet provided is not enough for us to debug this issue. Ideally we would like a full classic sample for this issue as it requires setting up the project with jquery etc At a glance though, I don't think this will be a titanium issue, we don't own the webview or jquery. I did a quick search for "jquery unload safari not working" and there's a lot of stackoverflow posts about this being unreliable cross platform.

JSON Source