Precache html pages in flutter - flutter

I have a list of some HTML pages that i show in my web_view. The problem is that it will load slowly when network is slow or wont show at all if user is offline. So i want to pre-cache all the URLs before navigating to that page. After that I want to load from the cache and navigate through the URLs on swipe. (The Swipe part is done with URLs loading real-time). My question to you is how do I pre-cache every URLs and call it in my web_view later

If you are sure that those pages are static..I have a suggestion for you..
Like you said, you can pre-cache..
Initially, when internet is available you get the code of those URLs using
http package and store it in local storage, say some .txt file.
And then, when you want to show the page in your app, again..as it being static page, you can read the html code from local storage and show it in your app using html package.
Hope it answers your question.

Related

How do I rewrite URL to drop file extension for pdf on github pages?

Imagine my website is hosted on GitHub Pages and has a custom domain website.com. I can access a pdf at website.com/mypdf.pdf
Is there a way where I can make it work at website.com/mypdf?
As mentioned in comments, if you are using static website hosted by a 3rd party like GitHub pages, you don't really get a lot of control over http server. I would tentatively say you cannot control URL rewrite rules on GitHub.
What you could potentially do instead is to host a page with a bit of JavaScript that would start the download on a given event (button click, page load, etc) this way you could mask your actual download URL with this html page (that by convention comes with no file extension)
UPD: and surely enough someone's been doing it already: http://lea.verou.me/2016/11/url-rewriting-with-github-pages/. The post is going on about having nice urls, but I believe file downloads implementation can be implemented similarly
Yes you should make your website with MVC structure. Make a controller and in Index action load pdf file.
Then on action calling your pdf will be loaded like that:
Students/AllResult etc

How to read website content in Flutter webview?

I want to read the contents of a page opened with Flutter webview. Before the page opens, the user needs to manually enter the information on the previous page, and I have no chance to do this in the background with http. How can I get the data on the opened page with WebView (which can be webview_flutter or flutter_webview_plugin). Thanks in advance.
There is nothing out of the box exactly for that purpose, however, webview_flutter supports communicating with the page using JavascriptChannel. Using controller.evaluateJavascript, you can inject a script that sends the page content to the channel using postMessage. See the examples in the plugin repo.

Google Static Maps only shows map briefly after viewing it in a different browser tab

I'm building a rails app, and attempting to put multiple Google Static Maps into the view. These maps will always display broken-image placeholders, except it works when I:
-Use firebug to grab the src URL for the map image
-Paste the URL into another browser tab
-Refresh my apps page with the Google static maps
-I can then view a static map for the URL I pasted, but no others, and only for about 1 min.
Any map on the page I repeat this procedure for will then be viewable, for about 1 minute. Then after about 1 min, that map will revert to a broken image placeholder if I refresh the page.
An example URL from my app (without my API Key) is:
http://maps.googleapis.com/maps/api/staticmap?center=Paris%2C+France&zoom=13&size=600x300&maptype=roadmap&sensor=false&markers=color:blue|label:A|Paris%2C+France
Paste (or click) this into your browser, and you see it works. I paste this URL WITH my API key in it into my browser, it works & and my app will show the static map for a limited time, and then after that it will be broken again. If I paste a URL without my API key, this procedure doesn't work. It's like viewing the map in another browser tab somehow caches it momentarily in my browser, and it will then work in my app... but then it will break in a minute. Haven't found any other way to make map images viewable.
Any ideas why this would happen?
EDIT:
This is extremely strange. In an attempt to diagnose this, I did a copy/paste/save of the apps page source containing the broken map images, and put it on a remote server out in the World. In this new totally static page, I got the same result: I see broken placeholder images where the google map pic should be. But after I copy the src URL of the image & paste it in another browser tab, I can go back to the static page, refresh & only that map image appears.
Stranger still (maybe?), it shows up on my localhost app too. It also shows up on a static local copy/paste of the app page source I save as an HTML file.
So, not saying this must be it, but it seems to be a browser caching issue. No matter where the view page is represented, whether local or remote, and no whether it is dynamically generated or static HTML, the original behavior remains the same.
Maybe you are not considering that the referrer is the one who shows the static map. Check these examples:
Static map shown in https://developers.google.com/maps/documentation/static-maps/styling?hl=nl: the referrer is https://developers.google.com
You grab this link (that is already in the url of the URL on bullet 1) https://maps.googleapis.com/maps/api/staticmap?size=512x512&zoom=15&center=Brooklyn&style=feature:road.local%7Celement:geometry%7Ccolor:0x00ff00%7Cweight:1%7Cvisibility:on&style=feature:landscape%7Celement:geometry.fill%7Ccolor:0x000000%7Cvisibility:on&style=feature:administrative%7Celement:labels%7Cweight:3.9%7Cvisibility:on%7Cinverse_lightness:true&style=feature:poi%7Cvisibility:simplified&key=YOUR_API_KEY and you paste it in your browser: the referrer is YOUR PUBLIC IP.
So it's normal if the link does not work in any browser but it works in a determined web page. This happens when the authorized referrer is only the host of the web.
Consider also that you may be hitting the free limits of displays per day.

problem getting my domain redirect to update .html files in dropbox after used iweb SEO TOOL

So I created a nice 6 page website hutchspropertyandtree.co.nr using freedomain.co.nr via dropbox public folder. Everything was working and updating properly until i updated with iwebs SEO TOOL. I added meta and title tags as well as description etc... PROBLEM is that even though my .html files in dropbox are correct and show all new code and tags. when i open up my domain hutchspropertyandtree.co.nr it doesnt show any of my recent seo tool updates.
im thinking that the cheap domainname from .co.nr is the problem? Is it possible that the default tags and titles and keywords entered into the co.nr website creation boxs are overwriting the newer ones in the html within my dropbox?
But still doesnt explain why a stat counter code and google analytics code in the footer and header respectively still do not show up when i view source in browser.
PLEASE PLEASE HELP.
It's because the page at hutchspropertyandtree.co.nr uses a frame to show the content from another location. The meta information comes from the page with the frame, not the page in the frame. You should be able to see the content of the frame using an inspector (comes with all browsers these days) or "View frame source", if your browser does that.
Note that any search engine hits to your pages will link to the dropbox URL, not the frame page (that has essentially no content from the viewpoint of a search engine). If you want search engine results to show up under that domain, you'll have to get hosting that lets you point a domain directly to it.

webkit .appcache file caches dynamic page

The main page of my mobile web app is a .jsp page. My app requires login (Google App Engine), so there is a Log In button when the user is not logged in and a Log Out button when the user is logged in, all handled by code on the .jsp page.
I load a lot of JS code on the page, so I used a .appcache file to cache that. Unfortunatelly, even though I added my .jsp page to the Network area, the page is being cached in a funny way, ignoring the content server from the server. That means that my Log Out button shows when users are Logged Out and vice-versa.
I tried to add no-cache directives as meta tags, but they are all being ignored.
Ideas?
According to dive into HTML5, the page that references the manifest is automatically included in the manifest.
http://diveintohtml5.ep.io/offline.html
Q: Do I need to list my HTML pages in my cache manifest?
A: Yes and no. If your entire web application is contained in a single page, just make sure that page points to the cache manifest using the manifest attribute. When you navigate to an HTML page with a manifest attribute, the page itself is assumed to be part of the web application, so you don’t need to list it in the manifest file itself. However, if your web application spans multiple pages, you should list all of the HTML pages in the manifest file, otherwise the browser would not know that there are other HTML pages that need to be downloaded and cached.
I have a similar issue, and I think I will end up loading the contents of the page via AJAX.
Caching in appCache is a two stage process: first the cache manifest is checked (in this case, as the page is loading), then if the content of it has changed, that content is reloaded. However, in your case, by that time, the stale page is already loaded and displayed.
The easiest fix would be to specifically exclude the page (but not the .js) from the appCache, so that only the js is cached, and not the page. I sounds like you might have figured that out, as you are trying to do it by putting the page in the network area. Check that that exclusion is correct, as that sounds like the problem, and that html cache attributes are being set correctly on that page.