Difference in opening a file directly and uploading to a web server - html

Given a simple HTML file is there any difference when testing, in opening it directly by double clicking it or uploading to IIS/Tomcat and accessing localhost/simpleHTML?

In the case of html files it dosenot matter much. Where this matters is when the page is made in languages like php, jsp etc. A webpage containing php or jsp files will not be detected by browsers when directly opened. For this we use webservers like wamp, xampp, lamp, tomcat etc and acces it via localhost/pagename. For more details just view the pagesource of a php file. You wont be able to find and php scripts in it. You will be able to see only the html part in the page. For scripting languages like html, javascript, css etc. opening directly dosent matter.
Hope this is useful to you.

No, a simple HTML-only file will not be rendered differently most(99.9%) of the time by opening it directly by double-clicking from the local file system and accessing it from a web server. The only difference will be caused if the file contains any server side language (PHP, ASP etc..)

Related

Download attribute opens file instead of downloading

I want to test downloading a local file using the <a> tag in HTML. The attached code doesn't seem to download the file, instead, it opens it.
<p>Interested? Download <a href="download_files/ChannelLogo.png" download>here</a></p>
Your code is correct, however, the download attribute only works when you are viewing the code from a server, due to the same-origin policy of most browsers.
Are you previewing the file by double-clicking the file or directly opening it up in a browser? If the URL while previewing starts with something similar to file://FILEPATH_HERE or /Users/FILEPATH_HERE, you are opening the file rather than serving the file. If so, you should run your code from within a localhost setup to test. That may involve running a server locally, or using an editor extension to spin up a project-based server. Once your URL starts with http:// or https:// the download will work as intended.
Alternatively, you could upload the project somewhere on the web.
It depends on where the file is located and how files are being served.
Either way, whether it is a plain static website with local files or being served by a server, you might need to check the href again to make sure it is correct.
Could be something small like /download_files/ChannelLogo.png instead of download_files/ChannelLogo.png.
Edit after question update:
Yes answer by Riley is right: it will only download if you are using a server. You could use a server like Node.js to run and test what you would like to do.
Otherwise you could look into Electron if you would like to work with the filesystem more directly, all depending on what it is you would like to do with your program.

Get .html filename of a website with Firebug

How do I find the filename of an website I am inspecting with Firebug? As example when I look on http://example.org/ I can view inspect the Element, I see the whole html structure but I didn`t find the filename. I am searching for index.html or something in that way. Maybe this is an analog question, but I am not sure, because he/she is working with php. LINK
I know there are some solutions with Dreamweaver or other tools but I am searching for an easy way to figure that out with Firebug or an free Browser Add-On. I Hope you have a solution for that.
The URL you entered is the one that usually returns the main HTML contents. Though on most pages nowadays the HTML is altered using JavaScript. Also, pages are very often dynamically generated on the server.
So, in most cases there is no static .html file.
For what it's worth, you can see all network requests and their responses within Firebug's Net panel.
Note that the URL path doesn't necessarily reflect a file path on the server's file system. It is depending on the server configuration, where a specific URL maps to in the file system. The simplest example is the index file that is automatically called when a domain is accessed. In the case of http://example.org the server automatically loads a file index.html in the file system, for example.
So, in order to get the file name on the file system, you need to either check the server configuration or the related access logs.

How can I open an ASP page from HTML page?

I am working on an asp project, its my first time uploading it to a server (a server provided at my campus)
i will have a mix of HTML and ASP pages. I want my HTML page to be my default page, while I have links on my HTML pages pointing to asp pages.
From my local machine it worked fine (of course its local. i used the localhost:XXXX address as a link, but i know it wont work when i upload to the server). I'm using visual studio 2012.
Can anyone point me to the right direction?
It might be possible that the server you are uploading to is a plain file server, and not a ASP server. If that is the case, a link to a particular ASP file would simply display its contents and not the HTML page that is generated on your local machine by your ASP server.
You should check to make sure you have ASP.NET Register in IIS.
link: https://msdn.microsoft.com/en-us/library/k6h9cz8h%28v=vs.140%29.aspx
aspnet_regiis -iru
Run this command from both of the install folders listed below (v2 & v4)
C:\Windows\Microsoft.NET\Framework\v4.0.30319
C:\Windows\Microsoft.NET\Framework\v2.0.50727
Hope this helps.
I might be misunderstanding your question completely, but...
Your IIS (web server) will have a collection of "default documents", i.e. documents it will look for if no path is provided, for example if you browse to the root of your site, such as http://tempuri.org/
What is the name of your HTML document? If it's index.html for example it should be loaded as the default. Some more info on default documents here.
Now, if you link to .html or .aspx files in your HTML doesn't matter. But if the .aspx files don't work, you should verify you have ASP.NET installed (as per answer by GlennFerrie).

How to show list of web server files in HTML

I want to show list of all files from web server or a directory from web server into my WEB page using HTML.
I searched google a lot but didn't find anything.
Any suggestions?
Possibility 1) activate DirectoryBrowsing [aka DirectoryListing] (Apache, IIS and probably all others support this).
Possibility 2) use PHP, JSP, ASP or whatever language to make a list of the files.
HTML itself is just a markup language, so there's no possibility to do that with HTML only.

in HTML page can we use jsp code

In page.html we can use javascript code, I accept that, but can we use jsp and tld files in html files.
Please explain.
Any server-side code would need to be executed on the server, not in the browser. There's a hard separation between the server-side processing and the client-side processing. So the JSP code wouldn't be able to interact with the JavaScript code or anything like that.
In order for server-side code to be executed in an HTML file before rendering it to the browser, your server would need to be configured to process that code. It would be a matter of configuring your web server, whichever one you're using. By default I imagine it just returns .html files to the browser without any server-side processing. But you can configure your web server to treat .html files just like it would JSP files.
Keep in mind that you would need to treat those .html files like you normally would JSP files. It would have to match the same conventions for separating client-side code from server-side code.
If you configure your web server to map the text/html content type to JSP, you can.
No. JSP pages are executed on the server side and produce HTML, which is sent to the browser. JSP acts just like PHP in this regard, essentially "rendering" some HTML code and sending it off to the user. You can't embed JSP code in the HTML and send it off to the user - their browser will just do nothing with it.