Problem run Flutter Web app in our company network - javascript

I'm trying to run my Flutter Web app on Local Area Network (intranet) in my work. But there is no internet access. And I have this issue “ Failed to load resource: net :: ERR_INTERNET_DISCONNECTED “. I think, problem is with canvaskit.js because my app try to download from internet. Do you have some idea how to fix it?

This is a common mistake when you use Flutter web within an Intranet that has no Internet access. I will try to explain it in detail.
In Flutter Web you can choose between two web renderers (more info here). The default one is CanvasKit, but there is also the HTML renderer.
The problem with CanvasKit web renderer is that when you start the application for the first time, it goes to unpkg.com and downloads two files: canvaskit.js and canvskit.wasm. Once downloaded, the browser caches them and Flutter doesn't need to download them again in the future.
But, if the app can't download these files, the application fails to start. Which is the problem that #TomášTorok mentions.
What are the solutions? There are two possibilities:
1 - Force your app to use the HTML web renderer, as it doesn't need to download anything over the Internet. This web renderer has some limitations that CanvasKit doesn't have, and vice versa (in this article they explain everything in detail)
To use the HTML in debug:
flutter run -d chrome --web-renderer html
OR if you want to build your app:
flutter build web --web-renderer html
2 - Download manually the canvaskit.js and canvaskit.wasm files from unpkg.com (example link), add them inside your project (inside /web folder), and force Flutter web to grab the local files and not download anything from the Internet.
It's a bit more work, but it's not complex either. You have the instructions in this link.

If I understood correctly;
There is nothing to do with flutter version or flutter channel. The error message is clearly explaining that internet is disconnected. The universal truth is you need a minimum speed internet to debug or release your flutter code development. Try to check the internet connection.
Reply back if this answer is helpful to you, also share how did you solved the issue.

Related

Error when trying to connect Metamask to Unity

I'm developing a decentralised videogame using Unity. To connect Unity to Metamask I'm using a library called Web3GL.
When I try to connect my account to Metamask this message pops-up
I've been experiencing this problem for a long time now and I really don't know what to do about this! The fun part is that when I try to build and run directly from Unity it works but when I embed the game inside my webpage I receive this pop up.
Does anyone know how to help me?
The error points me to library code that I've never touched so I don't think I've created the problem.
This is a problem caused by encoding issues. You're probably using Brotli encoding in your WebGL builds (Build -> Player Settings -> Publishing Settings -> Compression Format). And it's known that somehow in local servers without HTTPS, this error may persist. (I'll investigate more and edit my answer including the reason in the future, hopefully). In order to get rid of the issue you may disable Brotli encoding or turn on Decompression Fallback in Publishing Settings.

Issues webview Android application

I make a web application using quasar and java spring boot backend. I convet my web application to an Android application using webview. But when i published in play store, its gives security issue for my backend server url. But i do not collect any data or install anything in Android apps or user device but Google gives an exception in my Android App. How can i fix this issue in Android web-view apps.
This warning is sent by Google Safe Browsing service, which is embedded in the Google Chrome Browser and several other browsers, this service looks for vulnerabilities principally in the markup; for example open tags that could lead to a code injection or other possible threats. The Safe browsing service is independent of the GCP Serverless services, this means that GCP is not marking the site as dangerous.
To prevent this message from appearing, or remove it we can do the following:
Look out for potential vulnerabilities in the app, once the changes have been made, you can use this page to see the Safe Browsing Status.
If you think that there was a mistake, you can request a review to remove the Phishing Warning in this site.
It is highly recommended to take a look a this documentation to understand what could be the reason behind the message
My issue is now fixed. It ended up being a hosting server issue. Google had me on a black list, but now its fixed.

Google sign-in in an Electron.js application not working

I'm making a desktop app version of a website with electron. The desktop app itself works, but the google sign in does not work because "this browser is not secure."
Opening the sign-in page in a secure browser will not work here because i did not make the actual sign-in version itself, I am only making the desktop app version.
I've seen other posts where they say to change the userAgent, but Google has disabled that, so it will not work.
I also have used a solution with nativefier app --userAgent..., but the Windows and Linux versions become messy with a bunch of extra files after building. I would like to get a single .exe file for Windows and a single .AppImage or .deb file or similar for Linux if possible.
If you have any solutions or workarounds for this, please let me know. Thanks!
I managed to log in with Google using this package: getstation/electron-google-oauth2. This package will open a browser window for the log in, then successfully pass it to Electron app. There are examples in the readme demonstrating how to make it work.
Also make sure that you configure a desktop OAuth 2.0 Client ID for the app:

How to run a script from the Web in a Windows 8 app?

My organization already developed iOS and Android apps, and is starting to develop an app for Windows 8. In case it matters, the app is using Phonegap a.k.a. Cordova.
On the existing apps, the user downloads a very "slim" app from the store, containing a minimal HTML page. The user logs into a server, and then script tags are dynamically added pointing to locations on that server. Similar to web apps, scripts are downloaded to the client and then executed.
Windows 8's new security model blocks this behavior. Since the app runs in the local context and the script is on the web, I get the error "An app can’t load remote web content in the local context."
Is there a way to get around this restriction?
I'm open to "creative" suggestions and hacks, up to a point. I've already tried a few things, such as fetching a script with plain XHR calls and then injecting the response to a pre-defined script tag. Windows blocked this and all other attempts.
I also considered rendering everything in an iframe with a "ms-appx-web:" scheme (learned about this scheme here, "Schemas and contexts" section). This might allow me to load remote scripts, but would prevent code from accessing APIs of the locally-running JavaScript code -- Cordova and Windows Runtime. This access is necessary for my app. If there's a way to access Cordova and Windows Runtime from the web context, that might be useful too.
I very much doubt it.
The whole point of the MS Windows Store certification model is that they can test your code for malware/ crashes. If you can change the code on the fly, you could ship a perfectly harmless app, have it certified by MS, and then change it to something dreadful after the user installs it.

Phonegap app working locally, not working on phone

I have written a phonegap application, and it performs a pretty simple task, it gets some JSON from a YQL link, and then displays it nicely to the user. This works excellently when I run it using Google Chrome on a Desktop, but, my client tells me that it does not work on his device which is Android 2.3. What can be going wrong? I'm using phonegap build to build to app, and they tell me that it is given internet permission, but, when my client puts the APK on the phone (its not on the market yet), does he need to do something special for it to access the internet?
Thanks a lot,
Dhaivat
in phonegap, allow external host : Open phonegap.plist -> external host and add your url or * to allow all
within the phonegap app the webapp runs under the file:// protocol - this might affect things.
you should test this at least on an emulator yourself - clients usually screw up anything some might screw up when testing ;) best would be to test on an actual device tho.
I'm not sure if this will help but I had a similar problem testing my app here:
https://stackoverflow.com/questions/17496104/json-wordpress-feed-not-appearing-in-android-studio-emulator-using-phonegap
I needed to change access origin to ="*"/ in my config.xml

Categories

Resources