You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Jesse MacFadyen (JIRA)" <ji...@apache.org> on 2015/03/11 18:05:39 UTC

[jira] [Resolved] (CB-8275) Issue updating index.html at runtime‏

     [ https://issues.apache.org/jira/browse/CB-8275?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse MacFadyen resolved CB-8275.
---------------------------------
    Resolution: Won't Fix

Windows 8.1 does not allow script injection like this for security reasons.
You will need to write your application in such a way that you are not injecting '<script>' tags.



> 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
>              Labels: cordova, javascript, visualstudio, wp8
>
> 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: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org