Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2926] Android webview does not recognize Ti variable if url contains querystring data

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2020-02-13T14:35:29.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, feature, querystring, url, webview
ReporterRalf Pfeiffer
AssigneeIngo Muschenetz
Created2011-04-15T03:33:06.000+0000
Updated2020-02-13T14:35:29.000+0000

Description

If you create a webview, and try to pass data to it on the querystring, javascript inside the webview cannot see the Ti or Titanium variable(s).

For example:

var webview = Titanium.UI.createWebView({

// url:'ui/tree/demo2.htm?data=12345', // this does NOT work on Android, but is fine on iOS url:'ui/tree/demo2.htm', // this works on Android AND on iOS
top:0,
height:400
});

When the querystring data is include in the url, any attempt to use Ti.API or Ti.App inside the webview results in an error message:
ReferenceError: Can't find variable: Titanium
or
ReferenceError: Can't find variable: Ti

Comments

  1. Burggraf 2011-04-15

       var webview = Titanium.UI.createWebView({
           //url:'ui/tree/demo2.htm?data=12345', // does NOT work on Android, but works on iOS
           url:'ui/tree/demo2.htm', // works on Android and iOS
           top:0,
           height:400
       });
       
  2. Don Thorp 2011-04-15

    Reapplying edits.

  3. Timan Rebel 2012-08-28

    Same goes for appending hashes to local URL's. demo.html#hash also results in disappearing of Ti and Titanium variables.
  4. Rene Pot 2020-02-13

    should no longer be an issue

JSON Source