cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sumit Soman (JIRA)" <>
Subject [jira] [Commented] (CB-10598) Unable to run javascript in Cordova iOS project on simulator
Date Tue, 16 Feb 2016 11:54:18 GMT


Sumit Soman commented on CB-10598:

I'm a newbie with this and would appreciate if I could be helped with these issues that may
be trivial to you.

I opened the index.html file in Safari and got the following error in the web inspector:

Refused to load the script 'file:///Users/testProj/platforms/ios/www/cordova.js' because it
violates the following Content Security Policy directive: "default-src 'unsafe-inline' data:
gap: 'unsafe-eval'". Note that 'script-src' was not explicitly set,
so 'default-src' is used as a fallback.

My index.html Content Security Policy reads as:

<meta http-equiv="Content-Security-Policy" content="default-src 'unsafe-inline' data: gap: 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">

Could you please tell me how this can be fixed?

> Unable to run javascript in Cordova iOS project on simulator
> ------------------------------------------------------------
>                 Key: CB-10598
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaJS, iOS
>    Affects Versions: 5.4.1
>         Environment: Mac OSX El Capitan, Xcode v7.2
>            Reporter: Sumit Soman
> I created a cordova project, added the iOS platform and built the project. After that
I opened the .xcodeproj in Xcode, built it and the homepage showed the sample app homescreen.
I then created another js file with the following content in the Staging/js folder
> function testLoad(){
>     alert("Loaded!");
> }
> In index.html, I added
>  <script type="text/javascript" src="js/myScript.js"></script>
> and called the function
> <body onload="testLoad()">
> However no alert appears! How to fix? I am using xCode 7.2.1 and Cordova 5.4.1.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message