When I type my code in VSCode, it ends up looking like below in Google Chrome. Why would it be doing that?
I tried fixing my code and I expected it to come out looking cleaner in the browser. It actually just brought over all of the code.
When loading local files, browsers use the file extension to determine how to process the file.
Since your file doesn't have one, it treats it as plain text.
Rename it so it ends in .html.
From the URL, it is clear that you've not saved your file with .html extension. That is why it is showing up as text instead of a web page.
Save the file with name Mywebsite.html and try again. Hope this helps!
Related
Chrome has an extension called SingleFile. It basically saves a web page in a one file *.htm page that is a clone of the original website. I have seen something like this done with Mozilla MAFF format. The MAFF format saves the file in *.maf, and is you want to see contents (html, css, images etc.) you can change the format to *.zip. Then you can unzip it. With the SingleFile (Chrome) you can’t unzip the file by changing extension. Does anybody know how this is achieved? Is this a known thing that *.htm can offer? Thanks
The MAFF format saves the file in *.maf, and is you want to see
contents (html, css, images etc.) you can change the format to *.zip.
Then you can unzip it.
I'm assuming that you're really asking just how the image files are stored in .htm since html and css can easily be stored as text in htm.
It uses uuencode/uudecode to embed image files in the .htm file. More on that here:
https://en.wikipedia.org/wiki/Uuencoding
This is why changing the extension to .zip won't turn the file into a zip package that you can unzip.
Illustrative side-by-side screenshots of external vs. embedded image.
I found this article may help: http://www.techgainer.com/enable-single-file-mhtml-support-chrome/
On Chrome address bar, type chrome://flags, then hit enter. Now use Ctrl+F (Command+F on Mac) bring search bar and search for mhtml as I did below. Once you find the option, click on Enable link.
When I reference a .pdf in my webpage, the file doesn't open when I click on the link. I referenced the .pdf with the full path and the file is in the www folder.
When I hover over the link online, I can see that the link is to my .pdf on file but it doesn't open.
What am I doing wrong?
Thanks (HTML newbie)
Edit 1 - reference:
Filename
Edit 2:
I tried the local links extension and it still isn't opening. I also tried <a href="http://www.example.com/myfile.pdf"> and I get a 403 Forbidden error.
Modern browsers block links to file:// URLs from pages that aren't themselves on a file:// URL, and in the same directory tree.
This is a security feature. There are workarounds that you can install locally so it works on one specific computer. See this Mozillazine article.
Sorry - I don't have the rep to comment. But it looks like your ref structure could be wrong.
Try something like:
<a href="http://www.example.com/myfile.pdf">
UPDATE: Hmmm?
Have you tried just:
<a href="myfile.pdf">
Also, I found this which (while not directly relevant) has some discussions and links that may assist: How to set height on PDF file when linked to from HTML?
^^ Ignore that - it really is more related to how the pdf opens.
FURTHER:
I am assuming the pdf file name has no spaces in it. I also assume you have a local pdf viewer.
So I had a look at a random website which had a pdf link as an example. When clicked, it opened the pdf in a new tab. I am on chrome.
You may be able to use that to figure out what is wrong.
Here is the page: http://www.staff.uwa.edu.au/procedures/communications/media/uwanews
Looking at the pdf for the first listed file, this was their link:
Issue-10-December-2014 [PDF File, 2.0 MB]
It looks like path should be enough, but you might want to add the target="_blank" to open in a new tab.
Maybe also see this, which shows that users set how a pdf is opened - perhaps the settings on your end need to be set up: How to open link to pdf file in new tab using html
Anyway, I wish you the best. Post your answer when figure it all out.
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.
I'm working with some pre-existing web files for a website, and I see there are files with .hinc ending. The code inside them is HTML, but Sublime Text 2 doesn't seem to recognize it, and doesn't color anything. Also, the code still runs on the website.
.hinc is an included HTML source file in c++. See this link http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3325.html#style.hinc
I have made my first website and in the preview in Safari and Chrome from Dreamweaver it works fine. But after uploading my files with Filezilla to 000webhost and typing in the URL, only the index page loads, links to other pages on the site don't work, images are broken and the css isn't applied.
I'm think it is because I haven't named the files correctly in the code, but I have no idea what to call them in order to get it right.
The file you upload to is public_html. So I've tried http://www.webaddress/public_html/Pages/entertainment.html but it didn't change anything.
Thanks for any help!
Without code examples it's very difficult to answer this, but it's probably just that your URL format is incorrect.
For example, if you've got example.com/example/example.html and that page contains a CSS file with a location of /css/style.css, the web browser will look for example.com/css/style.css because the slash at the beginning of the URL tells it to go to the root.
In this case, your CSS file is probably actually in example.com/example/css/style.css. Remove the beginning slash so the location is css/style.css and the web browser will look for the file using the current page's location as it's starting point.