Should my index.html file be a text file? - html

so i am pretty new to this and i was wondering if the index.html file for my site is supposed to be a text file (also, i'm on Windows 10). When i create the index.html file in file explorer the file that makes the most sense to me is a text file. (The files are: bitmap image, contact, rich text document, text document, and compressed zipped folder), So i would assume i'm supposed to pick text document. The folder ends up looking like index.html.txt, not sure if this is how i'm supposed to do it.

Start notepad, or an editor of your choice.
Type in the content you want for your file.
Save-As “Index.html” in the location you desire.

Well, the file extension is in the name itself ".html" just the same as a Cascading Style Sheet (CSS) file would be saved as a ".css" file and a Javascript file as ".js"
Everything after the "." is the type of file.

Yep, everyone above answered correctly. You want to save the file in a plain-text format with a .html at the end. Then you can open it in a browser like Internet Explorer and it will interperate the file as an HTML page.
You can use a program like CoffeeCup to easily edit HTML files and it will save them as plain-text.
You can't edit HTML files in rich-text editors like Word.

Related

why we can't use text file instead of html file for web pages?

as you know txt files and HTML files are text-based documents and I want to know why we use .HTML extension?
I mean both of them (text and HTML files) are text-based but when I open txt file, my browser can't render it.
help me, please.
The .txt extension indicates a plain text file. HTML is text based, but it isn't plain text, it is formatted with HTML.
Software uses file extensions (or Content-Type headers if we're using HTTP) to determine how to treat a file.

HTML file displays as text. Why?

I'm not using PHP. XAMPP finds my .html file just fine, BUT it doesn't process the HTML. Instead, it displays the file as text.
Why?
This could happen if you have saved the file with the option (SAVE as text FILE)
for example if you have saved your file as abc.html then it would become abc.html.txt
enter image description here
so it is supposed to be a html file but it will become text file

How to write html file with a text editor

I am trying to write my first html document.
Here is the link to the reference.
I am using TextEdit on Max OSX 10.6 and after I save it (as an html file) it is opened by the browser by double clicking on it. However the source script text is shown instead of the html structure.
What I am getting wrong?
You need to convert it to a plaintext document
Click Format and then 'Make Plain Text', then make sure to save as .html
Does the icon of the file has an "e". Usually these kind of files should have an icon as an e. Also make sure you are saving it as .html file. I think the actual extension of the file is hidden.

Link to open PDF from folder

I have some PDF's sitting in a folder on my computer, is there a way to write a link to open them on to a webpage?
The main idea is when the site goes live the link will be used to download the pdfs from the folder, but obviously at a later stage the folder will be a temp folder on my website.
So at the moment i just want to open the pdfs from a link, and the final goal will be to have the links download them.
Can any one help me?
This is the file path to get to the pdf i want to link to.
C:\Users\Shaun\Documents\FormValue\CS1.pdf
How would i create the link?
If you want to have a link to a PDF, you just have to put the relative path to the file in the href attribute of an a tag. So let's say you had a folder called pdfs, with the file boom.pdf inside it, and folder called site sitting beside it, with the file site.html in it. Then all you'd have to do is put this link in the html file:
Link to a pdf
In most (all?) browsers now a days, that will open the PDF in a new tab. To download it you would right-click it and do the Save Link As thing. Just need to get the path in href right.
UPDATE
If you want to use the full path to the file, you need to prefix it with file://. Then you just put it in the href the same as with a regular link, ending up with something like:
Link to a pdf
This should work with your set up, but if the pdf and the html files are stored near each other, relative URLs are still a good option. A little bit of Google work should show you how to write those.
For each PDF just do what I talk about here.
<object height="950" data="sample-report.pdf" type="application/pdf" width="860">
<p>It appears you don't have a PDF plugin for this browser.
No biggie... you can <a href="sample-report.pdf">click here to
download the PDF file.</a>
</p>
</object>
It works with most browsers and it degrades nicely.
It sounds like youre asking if you can put a link on a web site to a PDF sitting on your computer. You can't. The files have to be either on another web site or on your site's server.
If you are using ASP.NET, you can have the link point to a handler that accepts a query string identifying the file, either by file name or a hash of the file. Then the handler can look in the folder for a file that matches the pattern, read the file as a byte array, and then write those bytes to HttpResponse.

Strange problem while compiling CHM file

I had to write some documentation. I wrote each page in MS Word and then save each *.docx as htm file. I'm using "HTML Help Workshop" (from microsoft) to compile a chm file.
I was able to sucessfully create a chm file but the problem is that not all images in chm file are displayed. I tried decompiling the *.chm file into another folder and opened each .htm file in web browser. All images are correctly displayed.
Then why aren't they displayed in chm file. Strangely, only some of them aren't displayed. I checked if image format is causing problem, but all images are of same format. I checked if file naming is a problem, but all images are named like image[001-100].jpg in their corresponding folders.
Any idea about whats going wrong?
HTML Help Workshop (HHW) is known to have problems with the HTML generated by Word (or better put: Word generates terrible HTML). Some versions put VML coding around the IMG tags that HHW cannot handle.
Possible solutions:
In Word: Deselect the option 'Rely on VML for displaying graphics in browsers' (Tools > Options > General > Web Options)
In Word: Save as 'filtered HTML'.
In HHW: Manually add the images to the project's [FILES] section.
Let me know if any of this helps.
More information can be found in the HTML Help 1.X FAQ