You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "breautek (via GitHub)" <gi...@apache.org> on 2023/09/18 11:16:53 UTC
[GitHub] [cordova-browser] breautek commented on issue #126: cordova create - install browser - plugins.js” was blocked
breautek commented on issue #126:
URL: https://github.com/apache/cordova-browser/issues/126#issuecomment-1723204382
> The issue is with the Browser Platform. When I run cordova run browser I get this error: The resource from “[http://localhost:8000/cordova_plugins.js”](http://localhost:8000/cordova_plugins.js%E2%80%9D) was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
The `cordova_plugins.js` file doesn't exist and this is indicated by the fact that the server is returning 404. What is likely happening is because the file doesn't exist, the server is returning back an error response that is textual, instead of what would be expected an `text/javascript` response.
I believe I ran into this issue before, not with the browser platform, but likely the same issue... the `cordova_plugins.js` doesn't get generated until at least one plugin is added to the project. If you don't actually use any plugins and if it doesn't prevent page load, then it might be safe to ignore this error.
> So the gets work to express - not the post. I can send you the files if it would help?
Based on your provided images, you have two servers: the cordova server (the `localhost:8000` server) and another server running on port `3000` which is presumed to be your NodeJS/express server. This will be cross-origin so CORS will be effect, and you'll have to respond with the proper CORS headers on your `express`. I do have the [blog post](https://breautek.com/articles/enabling-cors.html) that goes into more details, it's tailored for the WKWebView on iOS, but the same concept applies here. You may want to actually lock down `'Access-Control-Allow-Origin'` to the actual origin (in this cause `localhost:3000`).
**OR**
The cordova server is meant to be a simple quick way to test the browser application. It's not really meant for production use. And because you already have an express server, you can probably configure it route to `platforms/browser/www` and then everything will be hosted on the same server and you'll gain benefits of being on the same origin.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org