This question already has answers here:
Play local (hard-drive) video file with HTML5 video tag?
(4 answers)
Using local file as <audio> src
(2 answers)
Closed 4 months ago.
I know the New audio() is expecting a url but I am trying to load a local file and can not seem to get it to play. The path must be wrong cause it will play any existing url that I assign to a var including "data:audio/ogg;base64,T2dnUwACAA...". Example: "C:\Users\Jon\Desktop\tng-doorbell.mp3" will not play- it does nothing.
Thanks.
You need to load it via a server like Apache or IIS. Try Wampserver
It has to be a URL over http:// and not file://
Due to security issues, many HTML5 APIs will refuse to operate on local files (or will impose severe restrictions on how the file can be used).
Your best bet is to configure a local webserver, and access whatever you need through it.
Related
This question already has answers here:
What does "./" (dot slash) refer to in terms of an HTML file path location?
(12 answers)
Closed 1 year ago.
I am trying to include an image that is in a local folder. When I try to load it standalone(not served from a server) it breaks. When I load it from a server it has no problem. If both point to the same location what is the deal?
ex:
<img src="/img/example.png">
vs
<img src="./img/example.png">
You would use ./ when you want the path to start from the current path. This is often called a "relative path".
You would use / when you want the path to start from the root path. This is often called an "absolute path".
Note that in this case "path" is the URL components from the site root to the resource name, it has nothing to do with file system paths.
When I try to load it standalone(not served from a server) it breaks. When I load it from a server it has no problem.
I don't know what you mean by "not served from a server", but both of the src values you demonstrate are relative URLs. If you mean that you're trying to open the page from the file system and not from a web server then note that ./ has pretty much the same meaning in file systems, but / does not. Depending on the file system, it may mean the root of the entire file system or it may mean nothing at all and just be an error.
If both point to the same location what is the deal?
If one is failing and the other is not then they both do not point to the same location. You can open your browser's debugging tools and observe the requests made to load the image resources. Those requests would include the full URL (or file system path?) being requested by the browser, so you can see how your src values translate into actual requests.
As an aside, if you're trying to open the page from the file system then the short answer is... don't do that. It "works" for simple functionality, but a file system is not a web server. For any reasonable web development it's best to serve the content from a web server. (Which can of course be on your workstation for local development.)
This question already has answers here:
How do I change the default index page in Apache?
(5 answers)
Closed 6 years ago.
I have created a html file that I am trying to host on the localhost using wamp server so that anyone in the network can access it I have also updated the hosts file to
172.x.x.x www.kpcl.com
This works fine what, when anyone with this hosts file tries to access my page thing is person has to type www.kpcl.com/checkl.html where checkl.html is my file situated in www folder of wamp
in the url section I want that as soon as the person enters the www.kpcl.com by default the checkl.html page gets loaded what to do?
You'd have to alter the .htaccess file to read check1.html as the document root of kpcl.com. Normally pages named home.* or index.* are the first ones that a browser reads. Since you don't have it named either of those, and since it's probably not the only file in that directory, it doesn't know what to open.
This should help (near the bottom).
This question already has answers here:
.htaccess Rewrite to Force Trailing Slash at the end
(10 answers)
Closed 8 years ago.
I recently went to a webpage and noticed their directory page was customized.
putlocker.is/featured/
NOT
putlocker.is/featured
How would I costumize this on an Apache sever?
The URL you provide almost certainly isn't an Apache directory index (although there are some directives which can customise those, such as IndexStyleSheet). To achieve a custom page when a URL with a / on the end is requested then, given a vanilla Apache configuration:
Put an HTML document in that directory with a filename that is in the list specified by the DirectoryIndex directive. Usually this will include index.html.
You can also use a file that will generate HTML programmatically (such as PHP on a system with PHP installed) or divert the request (e.g. using ScriptAlias or mod_rewrite) to another program (which might use the front controller pattern).
Here is an example to use Catalyst for this purpose, you then define your URLs using Catalyst actions.
This question already has answers here:
Make index.html default, but allow index.php to be visited if typed in
(6 answers)
Closed 8 years ago.
Trying to upload a new site and the server isn't configured to resolve "html" rather than "htm" so I get the following message:
Directory Listing Denied
This Virtual Directory does not allow contents to be listed.
How can I reconfigure the server as opposed to renaming all the site files?
seems like an .htaccess file might be the answer but I can't find and/or remember what the syntax is that you put into it.
Easy way to do it: add the type to your root .htaccess file.
AddType text/html html
So: adds the MIME type text/html to files with extension html.
Hope this helps.
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
.htm vs .html
What is the difference between .html and .htm file extension in a Basic Web Page?
None. I believe .htm to exist only due to the MS DOS limitation of 3 characters for file extension, which then propagated as a bad habit to early windows versions and programs.
There is none. HTM is the shorted version invented by microsoft for their old 8+3 file format, where each file could have only 8 characters in the filename and three in the extension.
notihing , you can find your perfect answer here htm/html
Whether a URL refers to an HTML page or not depends on the server's content-type not on its file extension. For instance htpp://www.google.com/ returns HTML even though no .htm or .html can be seen. You could even configure your web server to make this URL: http://my.server.com/foo.jpg return HTML instead of a JPEG image. As far as URLs are concerned file extensions do not have any meaning.
Basically, None.
.htm used to be normal when the length of the extension was important (in the days of 8.3 letter filenames) but that has not been an issue for a long time and .html is more common today since it is more descriptive.
So far as the web is concerned, you can use any extension you like or none at all (so long as the server is configured to send the right mime-type) - the extension is only an issue on your local computer.