I am hosting a cache manifest file for a friend, because his server serves manifest files as plain text and he can't change it. He's hosting the rest of his pages himself, on his server. So his <html> tag has a manifest attribute that is a complete URL that points to my server.
But it doesn't seem to be working. Is this because the cache manifest file is from a different host as the web page that it is in?
The manifest attribute can point to an absolute URL or relative path, but an absolute URL must be under the same origin as the web application
Source.
Related
I was learning about HTML domains and paths in my computer-science class. However, I have a question. What happens if you only specify a domain, such as apple.com instead of specifying a path? Does the page automatically give you the index file or something?
Thanks :)
That entirely depends on what the web server is configured to do. What you’re doing is you’re requesting a URL from a web server via HTTP. That does not inherently have anything to do with files. The web server can respond to the request in any way it wants.
But yes, most typically the average web server will look for a file named something like index.html in its webroot folder and return it.
yes, there is the default file that is returned if no path is provided
From Apache documentation
Typically, a document called index.html will be served when a directory is requested without a file name being specified. For example, if DocumentRoot is set to /var/www/html and a request is made for http://www.example.com/work/, the file /var/www/html/work/index.html will be served to the client.
From IIS documentation:
Default documents are enabled by default, and IIS 7 defines the following default document files in the ApplicationHost.config file as server-wide defaults: Default.htm, Default.asp, Index.htm, Index.html, Iisstart.htm.
(If you install ASP.NET on your Web server, the installation process will add the Default.aspx file to this list.)
I have an ASP 4.0 web site being served by IIS 8 that is in a folder outside of wwwroot. The site will load, but a css file that I am using is not being loaded (getting a 404 error).
Here's the folder path for the site:
C:/Sites/Test/"website I am using"
And the folder path for the css file:
C:/Sites/Test/sharedfiles/css/stylesheet.css
Here's the link I am using to connect to the css file (with spaces to get this to post)
< link href="~/../sharedfiles/css/stylesheet.css" rel="stylesheet" type="text/css" / >
This should load the css file, but it does not. I'd like to figure out how to get this working.
The Sites folder is shared for IIS_IUSRS and IUSR and permissions are passed down to the folders below, including the Test/sharedfiles/css folder.
The web site folder is what's selected by IIS for the website. I have Anonymous Authentication enabled for Application Pool identity and Static File serving is enabled.
I'd appreciate any other ideas on how to figure out the problem!
Make sharedfiles a virtual directory and establish a web site or a web application there and access your resources (css etc.) using a url. So in local host you would have http://localhost/sharedfiles/yourcss.css
Thats the correct way to do it - what you are trying to implement here is your own CDN.
I have the following appcache manifest:
CACHE MANIFEST
# Cache Manifest timestamp: 1361723106
CACHE:
offline.html
offline2.html
offline.manifest.php
NETWORK:
*
FALLBACK:
/ offline.html
I am using this on my local installed server.
So when I load the index.html file which links to this manifest file, the consolse in Chrome shows me that all files are cached properly. When I now shut down my local server and try to access the index.html file again, then I see the content of that index.html file. I was expecting to be "forwarded" to offline.html. What am I doing wrong?
Thanks in advance!
Although you speak of an "index.html" file, I'm assuming you're accessing the resource like this: http://yourlocalservername/ .
The resource that links to the appcache manifest (in this case "/") is always included in the application cache. Fallback applies to resources which are not in the cache, so the result you get is expected.
The only way to show an "offline indicator" when accessing a previously cached resource, is to ensure the cached resource includes javascript code that actually checks if the browser is offline. You could check navigator.onLine and/or check with XMLHttpRequest to see if your server is reachable (and functioning).
I am doing some basic HTML exercises on a Mac OS 10.6.6.
Say I am here:
rootfolder/index.html
and I want to go here:
rootfolder/subfolder/index.html
I understand I can use the relative path to make a link:
link to subfolder
^ this works for me in my browser.
And if I wanted to shorten the href, I could just do this:
link to subfolder
When I click the short version in my browser, the link takes me to the folder on my desktop (not to the page in my browser)
I'm wondering, do the files need to be in a web host environment for
the short version to work in a browser?
When /bob/ => /bob/index.html works, it is generally because the server has listed it as its directory index, e.g. with Apache...
DirectoryIndex index.html index.php
...meaning in the request of a folder, it will first look up to see if an index.html or index.php exists (in that order).
So if you are running it from the folders of your local filesytem (i.e. on the file: protocol), it has no server and does not know that a blank directory should request index.html.
The serving of index.html (or index.cgi or default.asp or whatever) when requesting a url that points to a directory is done by the server, not the browser. It is usually done as a result of configuration setting.
It's neither a property of HTML nor a property of urls.
If your browser doesn't serve index.html — and I don't know any that do — then you've answered your own question.
Mac OS comes with Apache (the most commonly-used open-source web server) pre-installed. You can set it up by going to System Preferences, choosing the "Sharing" preference pane, and then checking the box to turn on Personal Web Sharing.
Once you've turned on Personal Web Sharing, http://addressofyourcomputer/~yourusername/ will point to the Sites directory in your user's folder in Mac OS (i.e., /Users/yourusername/Sites/). With Apache running, if you go to http://addressofyourcomputer/~yourusername/subfolder/, it will in fact serve up /Users/yourusername/Sites/subfolder/index.html if there is an index.html file in that subfolder.
Without turning on Personal Web Sharing, though, there is no server running, and so your browser is really just directly accessing your computer's filesystem. As a result, when you ask for a folder, it literally returns you that folder, whereas Apache server knows the convention that /subfolder/ is really a request for /subfolder/index.html and will re-direct you accordingly.
The default page setting/redirection works only on web servers. The browser do not have intelligence(?) for such redirection. So the second option will not work.
Just started a site and I have an /img directory on the main domain. I would like to set up a subdomain(where the file folder is just another one in the main directory) that is able to use the /img folder but it doesn't work.
The /img and /subdomain folders are on the same level, so to display images in the main domain I type: <img src="img/image.jpg">
and for the /subdomain I type: <img src="../img/image.jpg">
and I get a 404 error for the site: http://subdomain.example.com/img/image.jpg
As you can see, I want it to be linking to http://www.example.com/img/image.jpg
Can anyone tell me how to achieve this? I would prefer not to link images to their internet directory (i.e. http://www...) because I would like to modify the sites on my computer and upload them via ftp.
I'm sure it's just something that I am messing up or don't completely understand. Thanks in advance!
Relative paths are always relative to a URI. If you have a page at http://subdomain.example.com/ containing a link to ../img/image.jpg, the web server translates it into a link to http://subdomain.example.com/../img/image.jpg. Obviously the web server can't serve anything above it's root directory (that's the whole point of having a root).
Your webserver is configured to only serve content in the /subdomain directory, but obviously /img is not inside that directory, and can't thus be served. What you need to do is configure your webserver to look in /img (the directory on your filesystem) instead of /subdomain/img when it gets an request for any content at http://subdomain.example.com/img/
With Apache this can be done with mod_alias.
Summary: Use mod_alias to map requests to http://subdomain.example.com/img/ to the directory /img.