Comments (12)
Hi,
I was able to recreate the scrolling issue with a plain JS UWP app, so it is not an issue with Cordova. Seems like on a UWP app running in local mode (and only in this case and platform!) it is necessary to enable scrolling by setting the css overflow property. See also this thread for more details.
I don't know the reason for the CSP violations yet, however they don't seem to cause any issues in the app.
Thanks again for your help, I really appreciate your quick responses and suggestions!
Dominic
from cordova-windows.
Did I understand correctly that just toggling that preference disables or enables the scrolling in the app?
from cordova-windows.
@janpio yes exactly...
from cordova-windows.
And I just realized that only in local mode (where the scrolling doesn't work), the JavaScript Console in Visual Studio 2017 shows the following line when starting the app (not sure if always, but at least very often):
CSP14312: Die Direktive script-src ms-appx: 'unsafe-eval' blob: in Host Defined Policy wurde durch eine Ressource verletzt: inline script. Die Ressource wird blockiert.
Not sure if this is related or an issue though.
from cordova-windows.
It is definitely something I would investigate as it contains "ms-appx" in the error message string. Some security meta tag thing that blocks stuff?
from cordova-windows.
I tried but Visual Studio doesn't show where this CSP violation is caused and also the directive is not coming from my index.html. Seems like it is dynamically added by the runtime during startup?
So I am really clueless how to investigate this further...
from cordova-windows.
This sounds like the English version of your error message:
CSP14312: Resource violated directive 'script-src ms-appx: data: 'unsafe-eval'' in Host Defined Policy: inline script. Resource will be blocked.
(which also shows that the German version is a terrible translation, where does the "blob" come from?)
Here at least are some people having the same problem: https://forums.adobe.com/thread/2229445
Spend some time googling for the error message, I am sure you will find some instructions to add some preferences or meta tags.
from cordova-windows.
I don't think it's a translation issue, here is exactly the same error in English: https://stackoverflow.com/questions/51764412/ionic-documentviewer-in-uwp-windows-not-working?rq=1
CSP14312: Resource violated directive βscript-src ms-appx: 'unsafe-eval' blob:β in Host Defined Policy: inline script. Resource will be blocked.
I already tried a lot of possible combinations of CSPs, none of which worked and the error stays the same. I rather believe the UWP runtime adds this CSP rule dynamically when executing the app in local mode and this again causes issues when using Cordova-based frameworks or the WebView in general.
According to this comment, inline scripts are not allowed when running the windows app in local mode.
Unfortunately I need local mode as I need local network access.
As it seems that Microsoft doesn't allow inline scripts for the script-src, the question might be: Where is Cordova (or the Example App?) using inline scripting, is it necessary and would it solve the scrolling issue...?
from cordova-windows.
I don't think it's a translation issue, here is exactly the same error in English
Good catch, I didn't find this.
For all the rest: Sorry, no idea :/
from cordova-windows.
Okay I just tried to added the directive script-src ms-appx-web: 'unsafe-eval' blob:
to my index.html and switch the app to remote mode: I can also see the violation, but scrolling works fine.
So the scrolling issue doesn't seem to be related to the CSP violation (which possibly doesn't have any bad side effects).
To wrap it up:
- A CSP violation error due to inline script is displayed when running the UWP app in local mode as the runtime dynamically overwrites the script-src policy at runtime. It is unknown what's blocked exactly, but most likely unrelated to the scrolling issue
- Scrolling does not work when local mode is enabled.
Do you think I should check directly with Microsoft or the Cordova Core team? I have no clue how to continue analyzing this issue. We just recently migrated to Cordova. Before we were using Xamarin with a WebView for the same app and scrolling was working...
from cordova-windows.
If you have contact at Microsoft, go for it - they should know a bit about it.
I am one of the random (and volunteer) people that make up the Cordova Core team - there are currently not too many people around that know much about cordova-windows
. You might try mailnig the dev list or ask in the correct channel in Slack: https://cordova.apache.org/contact/
from cordova-windows.
Wow, that is a pretty surprising outcome. Glad you found out!
We should probably add this to the documentation then. Could you summarize the situation in one or two sentences and add it here somehow: https://github.com/apache/cordova-docs/blob/master/www/docs/en/dev/guide/platforms/windows/index.md#understanding-remote-mode-vs-local-mode (I think that is the best what we currently have in docs)
from cordova-windows.
Related Issues (20)
- JavaScript UWP development from VS 2019 not supported HOT 1
- JavaScript UWP development from Visual Studio 2019 not supported HOT 1
- Can't cordova build or run platform windows with Visual Studio 2017 HOT 3
- use @cordova/eslint-config HOT 1
- META: start major release 8.0.0 with some breaking changes HOT 1
- Can we use target minimum windows SDK version 10.0.16299.0 HOT 1
- Error: WebGL not supported HOT 2
- Windows: uap capability included when building for 8.1 HOT 1
- Using Chrome-based webview as rendering backend for Cordova for Windows instead of EdgeHTML HOT 2
- comma as decimal separator on ```<input type="number"> ``` HOT 1
- window.alert , prompt, confirm not working, please help me it is an emergency. Please please help me urgently.ππ»ππ»ππ»ππ» HOT 1
- The following navigation rule had an invalid URI scheme and will be ignored: "*". HOT 1
- Microsoft Surface hybrid touch events HOT 1
- Absolute (root relative) paths do not resolve to www folder, instead point to C:\... HOT 3
- Cordova installation problem HOT 2
- Running HelloWorld throws an error HOT 2
- package.windows10.appxmanifest does not set the correct descriptions as in config.xml HOT 1
- instructions from https://cordova.apache.org for platform Windows erroneous HOT 1
- The processor architecture of your project 'arm' doesnβt match the processor architecture 'x86' of the referenced project 'SQLite3.UWP'. HOT 1
- shelljs 0.5.3 is vulnerable HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-windows.