Android Webview Load Local Files in to Online Website - webview

I have made a Webview app to load a online site in to the view.
now i want to save the css and java script files into the app assets dictionary
to save trafik and speed for the website.
But i cant load the picture from the assets dictionary.
can anyone tell me what i am doihng wrong?
mWebView.loadUrl("http://www.XXX.de/android/index.html");
here the html file on an server:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Hallo</title>
</head>
<body>
<center>hans hallo</center>
<center><img src="file:////Android/data/com.news/files/weltuntergang.png" height="200" width="200"></center>
</body>
</html>

use
file:///android_asset/
to point to your assets directory
instead of
file:////Android/data/com.news/files/
probably you will need to use loadDatawithBaseurl in your webview for this to work smoothly (in my experience and guidelines recommendation)

Related

pyscript error with WordPress integration

Hi Goodies i have an issue in pyscript
issue : when i paste the below pyscript code in my WordPress post as an html and press preview it just simply popups to dawnload the pyodide file instead of showing the hello world message in the code below. Please someone can clear that to me why this is happening.
thanks regards
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
</head>
<body>
<py-script> print('Now you can!') </py-script>|
</body>
</html>
the output screenshots from the browser where i get this happening.
(1) From WordPress
this is once i write the code in real time wordpress post as an html
this is what i got once i click on preview
(2) Samething is happening in vscode live server instead of the showing the message hello world it just popup my dawnloader idm to dawnload a pyodide file.
this is the code in vscode with the live server
this is what i got once i run with the live server in vscode
i need to run a small python code in my WordPress post when someone visit my website and in that post once he requests some calculation so the python code should be responsible to do some calculations and show that to the user.
any suggestions please
From the logo on the popup messages you're getting in both cases, it looks like this is behavior caused by having [https://www.internetdownloadmanager.com/](Internet Download Manager) (IDM) installed.
When the Pyodide runtime loads, it fetches certain additional files from the web, including pyodide_py.tar (the compressed Python API files the Pyodide Python API, as well as any additional packages specified in <py-config>. If IDM is configured to interrupt fetching these necessary files, Pyodide will fail to load and/or execute.
You may be able to whitelist (allow) IDM to automatically download these files, but that's beyond my knowledge of that particular plugin.
For more discussion, here's a similar issue on the PyScript GitHub.

Strapi CMS not loading index.html correct path (undefined)

Im using Strapi 3.6.8 and i came cross a problem i cant understand with loading the Admin panel.
the CMS status page is working perfect and the API is responding with no problem, but when i try to open the Admin panel i get blank page (white page) and in the page source ican see that there are two files that get 404 error (not found).
The files are: runtime-main.XXXXXXX.js, main.xxxxxxx.chunk.js.
The probplem is clear - the files path is wrong as you can see in the files source:
<!doctype html>
<html lang="en">
<head>
<!-- The first thing in any HTML file should be the charset -->
<meta charset="utf-8">
<!-- Make the page mobile compatible -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="mobile-web-app-capable" content="yes">
<title>Strapi Admin</title>
</head>
<body>
<!-- The app hooks into this div -->
<div id="app"></div>
<!-- A lot of magic happens in this file. HtmlWebpackPlugin automatically includes all assets (e.g. bundle.js, main.css) with the correct HTML tags, which is why they are missing in this HTML file. Don't add any assets here! (Check out webpackconfig.js if you want to know more) -->
<script type="text/javascript" src="/undefined/cms/undefined/admin/runtime~main.1727abc3.js"></script><script type="text/javascript" src="/undefined/cms/undefined/admin/main.be8fb29b.chunk.js"></script></body>
</html>
unforthantly, i wasn;t able to figure it by myself, i tried the following:
Checked ENV files
Cleared yarn/npm lock files and node-module folder (and reinstalled)
Update packages
Build and run locally using docker (instead of just runing the server locally)
none of the things i tried is working, im sure it's something really small and stupid to fix. it worked perfeclty until somepoint, but i cant findout what was changed.
Thanks.

Application manifest working on android, iPhone, firefox, opera, but not on iPad

I'm having trouble getting a real simple html5 cache manifest to work on the iPad.
It does however work on all other devices and browsers I've tested.
Are there any bugs in the iPad safari implementation or other limitations to the iPad or am I missing something ?
I'll include the relevant source files.
index.html
<!DOCTYPE HTML>
<html manifest="example.appcache">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Hello</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
example.manifest
CACHE MANIFEST
# 2010-06-18:v2
# Explicitly cached 'master entries'.
CACHE:
index.html
style.css
# Resources that require the user to be online.
NETWORK:
I've read that on iPad the manifest file must be named "cache.manifest" and that you must specify it as a relative path like <html manifest="cache.manifest"> and not something like
<html manifest="/foo/bar/cache.manifest">. So, if it's working in everything else but just no in the iPad, check/try those two things.

BlackBerry WebWorks with OS 5, text not showing

I'm at the very early stages of writing a BlackBerry app using WebWorks. I'm aiming at mainly OS6 devices (Torch), but I need it to be compatible with OS5 for a small number of users who'll be using older devices. As far as I'm aware, WebWorks should work on OS5, however I have created a basic app with a hyperlink, and the text doesn't show on the OS5 simulator (it works fine on the OS6 simulator). All it shows is a blank screen. I've tried to just put some text on the app (i.e. not in hyperlink tags) and this doesn't show either.
HTML file as follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>
<meta name="viewport" id="viewport" content="height=device-height,width=device-width,user-scalable=no" />
<title>My App</title>
<script type="text/javascript" language="jscript" src="http://localhost/PubInfo/scripts.js" />
</head>
<body>
Click to show device model.
</body>
</html>
You'll notice the only unusual thing I've done (and this is reflected in the config.xml to load the index.htm) is to reference the script file from localhost so I can amend the app without recompiling, again this works fine in OS6 so I don't think it's this that is causing the problem.
I'm developing using the WebWorks Plugin for Visual Studio on Windows 7 (x64). Apart from referencing the files from localhost, everything else is default, i.e. as it is set up when you create a new project.
Has anybody come across a similar problem, and if so what was your workaround? Any help would be appreciated.
Its because your script is not well written (completed):
Also update your meta tags.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My App</title>
<script type="text/javascript" language="jscript"
src="http://localhost/PubInfo/scripts.js"></script>
</head>
<body>
Click to show device model.
</body>
</html>

iPad Home Screen Web App Failure

We've got an ipad web app that needs all the screen real estate it can get. The plan is to use the "add to home screen" functionality once the app is done. However, we've run into a major issue when launching the app via the home screen. When using the HTML5 doctype, the page simply seems to render as plain text (none of the stylesheets or javascript files are loaded). Instead, using the XHTML 1.0 Transitional Doctype causes the page to render correctly, but we're using jQuery Mobile, which requires an HTML5 Doctype to work.
I've made attempts to simply use 'full screen' meta tags and such, but they don't seem to work either. This is the current state of our header code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--<!DOCTYPE html>-->
<html lang="en">
<head runat="server">
<meta charset="utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<title>PAGE TITLE</title>
<link href="favicon.png" rel="icon" type="image/png" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.css" />
<!-- cut other stylesheets and javascript files being loaded -->
<link rel="stylesheet" href="/Vertex.Web/Content/style/tablet/tablet.css" type="text/css" media="all" />
From the research I've done, it sounds like the ipad uses a web.app instead of safarimobile.app when it launches from the home screen. I'm wondering if this is at least part of the problem. One other thought is that the ipad is trying to use a local cache when launching from the home screen, and it's just not liking the relative paths or external URLs when loading stylesheets and javascript.
Fun fact: using both Doctypes in the page will cause correct rendering the first time we open up the page from the home screen, but further attempts will fail due to a parse error (which is expected, since it's a terrible, terrible solution)
Try to add a manifest file, read more here
https://developer.apple.com/library/archive/documentation/iPhone/Conceptual/SafariJSDatabaseGuide/OfflineApplicationCache/OfflineApplicationCache.html

Resources