Titanium JIRA Archive
Appcelerator Community (AC)

[AC-732] Android : since 3.2.1 javascript file not loaded in webview on device

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionCannot Reproduce
Resolution Date2014-05-04T06:12:40.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterAdrien NEVEU
AssigneeRitu Agrawal
Created2014-04-17T13:06:03.000+0000
Updated2016-03-08T07:36:59.000+0000

Description

*Only on my device :* Since SDK 3.2.2 (perhaps since 3.2.1) when I am trying to load a js ressource on an html page loaded by a webview, I am getting the following error in the log: {noformat} [INFO] : I/TiWebChromeClient.console: (main) [50399,84113] Uncaught ReferenceError: Dygraph is not defined (107:file:///android_asset/Resources/graphe/graphe.html) {noformat} +It is working well with the SDK 3.2.0 on my device+ and it is working for all other emulators with all SDK This is the way I load the js file in my html file :
<html>
	
	<head>
		<script type="text/javascript" src="dygraph-combined.js"></script>
	</head>
        <body>
		<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
			
		<div id="graphdiv" > </div>
		
		<script>
			var g = null;
			var Ti = window.parent.Ti;
		      
	      g = new Dygraph(document.getElementById("graphdiv"),"Date,Data\n" 
                                   +"2014-01-20,50\n" +
                                    "2014-01-22,51\n" +
                                    "2014-02-10,53\n",
                                    {interactionModel:{}});
....

Comments

  1. Ritu Agrawal 2014-04-17

    Please provide a simple and fully functional test case to reproduce this issue.
  2. Adrien NEVEU 2014-04-18

    I have found why the application could not load javascript file in the webview: When I am using Titanium Studio to *Run on device*, the JS file next to the HTML file is not copied to the Ressources directory (in the build directory). But when it is *Run on the emulator* the JS file is copied. This bug seems to be there since SDK 3.2.1
  3. Ritu Agrawal 2014-04-22

    It appears related to TIMOB-16607 but it is strange that you are running into this issue only on device and not on simulator. Can you please provide a simple runnable project to reproduce this issue and we would look at it a priority?
  4. Ritu Agrawal 2014-05-04

    Resolving this issue as I cannot reproduce it and the reporter has not provided the requested test case. Would be happy to reopen this ticket once we have the requested information available.

JSON Source