Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16942] BlackBerry: FireEvent on webview is not working

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionNot Our Bug
Resolution Date2014-05-22T18:04:36.000+0000
Affected Version/sRelease 3.3.0
Fix Version/sn/a
ComponentsBlackBerry
Labelslook1, qe-3.3.0
ReporterPriya Agarwal
AssigneePedro Enrique
Created2014-05-09T11:12:08.000+0000
Updated2017-03-16T20:22:08.000+0000

Description

Steps to reproduce: 1. Copy paste the code in classic Project and run the app. 2. Click on WebView. Actual Result: Getting only One alert. alert 1: click event received Expected Result: Two alerts must be fired. alert 1: click event received alert 2: WebView received appClicked event But Fire Event is working properly on both iOS and Android platforms app.js
var win = Ti.UI.createWindow({
	backgroundColor : 'black'
});

var webview = Ti.UI.createWebView({
	url : "test.html"
});

webview.addEventListener("click", function() {
	alert("click event received");
	Ti.App.fireEvent("appClicked");
});

win.add(webview);
win.open(); 
test.html
<html>
	<head>
		<title>Test for textfields</title>
		<script type="text/javascript">
			Ti.App.addEventListener("appClicked", function(_event) {
				alert("WebView received appClicked event");
			});
		</script>
	</head>
	<body>
		Testing fire event
	</body>
</html>

Comments

  1. Pedro Enrique 2014-05-22

    For the web view to be able to receive and send events, it first needs to load the page and then wait a bit for the injection of the internal Ti javascript. Replace the JS in the html file with this:
       <script type="text/javascript">
           window.onload = function(){
               setTimeout(function(){
                   Ti.App.addEventListener("appClicked", function(_event) {
                       alert("WebView received appClicked event");
                   });
               },300);
           }
       </script>
       
  2. Lee Morris 2017-03-16

    Closing ticket as BlackBerry is no longer supported by us.

JSON Source