Francesco Negri created CB-8275:
-----------------------------------
Summary: Issue updating index.html at runtime
Key: CB-8275
URL: https://issues.apache.org/jira/browse/CB-8275
Project: Apache Cordova
Issue Type: Bug
Components: WP8
Affects Versions: 3.5.0
Environment: Visual Studio Community 2013 with Tools for Apache
Cordova CTP3.0
Reporter: Francesco Negri
Assignee: Jesse MacFadyen
Priority: Critical
We'd like to report some issues we are facing developing a Cordova app with
Visual Studio Community 2013 adding new code lines in index.html file at
runtime in Windows Phone 8.1. It seems that only HTML tags are correctly read
and executed, instead JS (included in a <script> tag or directly in the element
tag e.g. using onclick event) is not executed. We ran the same project on both
the Android emulator and physical device and it worked perfectly. Does anybody
know wether it's a compatibility issue or something else? Thank you for your
attention and help.
The code is:
INDEX.HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Tester</title>
<link href="css/index.css" rel="stylesheet" />
</head>
<body>
<input type="button" id="test" value="Prova x Emulatore wp" />
<!-- Cordova reference, this is added to your app when it's built. -->
<script src="cordova.js"></script>
<script src="scripts/platformOverrides.js"></script>
<script src="scripts/jquery-2.1.1.min.js"></script>
<script id="last_script" src="scripts/index.js"></script>
</body>
</html>
INDEX.JS:
(function () {
"use strict";
document.addEventListener( 'deviceready', onDeviceReady.bind( this ), false
);
var logOb;
function onDeviceReady() {
navigator.notification.alert('ciao');
// Handle the Cordova pause and resume events
document.addEventListener( 'pause', onPause.bind( this ), false );
document.addEventListener('resume', onResume.bind(this), false);
document.getElementById('test').addEventListener('click', function () {
var el1 = '<input type="button" id="Prova" value="Ciao"/>',
el2 = '<script
type="text/javascript">document.getElementById(\'Prova\').addEventListener(\'click\',
function(){navigator.notification.alert(\'Ciao sono il bottone\')},
false);</script>';
$('#test').after(el1);
$('#last_script').after(el2);
}, false);
// TODO: Cordova has been loaded. Perform any initialization that
requires Cordova here.
};
function onResume() { };
function onPause() { };
} )();
The TrialCode Team.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]