Issue in using application cache - html

Hi I'm trying to use application cache .As it is documented I'm getting a prompt like :
This website() is asking to store data on your computer for offline use .
with 3 options :
1.Allow 2. Never for this website 3. Not now
In my case only 3rd option works .Why?
Here is my html file
<html manifest="example.appcache">
.......
</html>

It's because you:
either are hosting the appcache file locally on your computer, and your computer does not return the correct MIME to your browser: text/cache-manifest
or your server (IIS/Apache) is not configured correctly to deliver the .appcaches files with the correct MIME.
For Apache you need to add this line to your .htaccess
AddType text/cache-manifest .appcache
For IIS, there are tutorials to be found if you search for "appcache IIS MIME"

Related

View files on linux remotely from browser

I have an HTML file that contains some data on different (text) files as well as where they are located locally on a linux machine.
This file is meant to be sent as an email, with the file locations being anchor tags.
I want to use my browser (Google Chrome) to view some files that are on that remote linux machine.
What I mean by that is the following:
View the HTML file in the browser of any PC (In this case multiple ones running windows)
When I click on the link, the file should open in browser (without downloading) as just plain text.
Basically I want to remotely view these files like how I can view anything on my local pc through my browser.
Is that even possible? If it is, please explain to me how it is done.
If not, can you suggest an alternative?
The Linux system that houses text files should have a server installed and firewall set. that serves required text files. Server can be any if you only need serving static files and not need any authentication or business logic. nginx and apache can do the job. and just in response header include
Content-Type: application/pdf
Content-Disposition: inline; filename="filename.pdf"
to force file to be viewed in browser.

HTML and HTAccess

I have been struggling with this all morning and I have not had much luck.
I am trying to get the following stackoverflow post to work: How to remove .html from URL
Here is my file directory with the htaccess file:
Here is my code that works fine using .html
So I went into sublime text and posted the same code into a .htaccess file as shown here (also in my directory first pic):
I then changed my links and removed .html
But I get an error
If anyone could please tell me what I'm doing wrong I would be grateful! Been bashing my head on this all morning
.htaccess is a file used to control access for Apache web servers. It won't affect anything unless you're running and accessing an Apache server. From your screenshots I can see that you're directly opening a file from your hard drive.
Your browser is saying File not found because you're trying to access a non-existent file. The address bar in your browser should say this:
file:///Users/mikegeng/Documents/GitHub/MichaelGeng.github.io/index.html
.htaccess is used by Apache Webserver. You must install and configure an Apache Webserver and access your site through http://localhost for example.
Currently your .htaccess is completely ignored until your site is served by Apache.

Application Cache html5

I'm learning how application cache works, but I got a problem.
I created my manifest file and 'imported' it in my index.html.
In the offline.manifest file I added:
CACHE MANIFEST
34567.js
and in my index file:
<html manifest="offline.manifest">
I'm working on localhost, but when I tried to search the script, I get nothing.
I erased the cache too, but result is the same.
I read about creating an .htaccess file and I created it with this string:
AddType text/cache-manifest .manifest
But, where I'd put it?
Apache's .htaccess file, which configures the web server, can be placed anywhere in the directory tree so long as you write your directive paths correctly. Based on the syntax AddType text/cache-manifest .manifest you'd need to keep the .htaccess in the same directory as the .manifest file here.
See this very similar question via the StackExchange network.
If you are not serving the .manifest with the correct text/cache-manifest content type it will be ignored.

link file extension correction

I was just crafting some html for a webpage on a local server on my mac. I added a link to a stylesheet stored on my local server, but forgot to add the ".css" file extension in the href attribute. I didn't realize my mistake until I uploaded my files to an externally hosted server--because somehow the stylesheet could be found without the extension on my local server, whereas when I tried to load the page from the external server the extension was not assumed and my styles didn't load.
What entity figured out my error and corrected it locally, and why wasn't my error corrected when the page was hosted externally?
It could be that your local web server is serving the file up as text/css and the external one is not. What happens if you use TYPE="text/css" inside your LINK tag to the CSS file? That should force it to interpret the linked file as text/css.

Load cache manifest file

How to make server to return manifest file with text/cache-manifest content type? By default, if I put it to the server and include into <html manifest="cache.manifest"> it is being loaded with type application/x-ms-manifest.
That's one of the reasons why the recommended extension for manifest files is now .appcache - Microsoft is already using .manifest for something else. To configure content types:
In IIS6 and below, add the MIME type mappings on the header tab of your virtual directory or web site properties (MS instructions).
In IIS7 and later, either go to MIME types in Features view or add a mimeMap entry under staticContent in your web.config like <mimeMap fileExtension=".appcache" mimeType="text/cache-manifest" />
you may include
AddType text/cache-manifest .appcache
in your .htaccess
or if you happen to use PHP you can send header information
header('Content-Type: text/cache-manifest');
Was having trouble caching an offline site on the iPad through GoDaddy hosting... Their mime type is incorrect for Safari support, so I simply made an cache.ASPX page:
<%#Page ContentType="text/cache-manifest" ResponseEncoding ="utf-8" %>
At the bottom of the page... Hope this helps someone!
You have to have a helicon file type .htaccess for it to work with IIS. Is can have an .htaccess file, just needs to be a # Helicon ISAPI_Rewrite configuration file
Version 3.1.0.82