I am just starting to code HTML and I am testing the following very simple code:
Google
However, it always thinks that the link between quotation marks is a file located locally in my website, so I end up getting an error page with the URL bar reading:
www.example.com/"http://www.google.com"
Obviously I am doing something silly, because this is really silly. How would I get my hyperlink to actually take me to Google (or whatever other website I wanted)?
EDIT: Since I have been told I shouldn't be getting an error and that I must not have specified something, here is my entire code:
<!DOCTYPE html>
<HTML>
<Head>
<title>My Website</title>
<meta charset="UTF-8">
<meta name="This is a website where I dump random stuff I am interested in.">
<Body>
<h1>My Website</h1>
<p>
<a href=www.google.com>Google</a>
</p>
</Body>
</Head>
</HTML>
In your full code, you are missing quote marks around the link. This isn't your problem though, you need to add https:// to the link for the browser to recognize it as an external link.
Google
Related
I am trying to write some HTML5 standards compliant code, where certain scripts need to be run only after the user has consented to cookies.
The html code looks like this, where the consent-script element, works exactly the same as the script element, however holds off loading the script until the consent has been given.
<head>
<consent-script src="myscript.js"></consent-script>
</head>
Everything works fine in all browsers,
However when I attempt to validate this using https://validator.w3.org/ , the custom-element tag apparently closes the head section, and generates a pile of errors.
Looking at the specifications, I can't see any reason why custom-elements cant be used in the section. But I am not sure.
My question is, can HTML5 custom-elements be used in HEAD? If I can, then its a bug in the validator service. If not, then I will have to find another way of not running a script until the right moment.
Thanks.
EDIT. Further investigation (Thanks #Danny'365CSI'Engelman) leads me to believe that even a browser is moving the custom element out of the head section, into the body section.
Some mock up code:
The source is:
<!DOCTYPE html>
<html>
<head>
<my-custom-elem></my-custom-elem>
<!-- other tags in the HEAD -->
</head>
<body>this is the body
</body>
</html>
Yet, chrome developer tools gives me:
<html>
<head>
</head>
<body>
<my-custom-elem></my-custom-elem>
<!-- other tags in the HEAD -->
this is the body
</body></html>
I am in the process of building a website and the browser keeps rearranging my HTML for some unknown reason. This is my code:
<DOCTYPE! html>
<html>
<head>
<title>Test</title>
</head>
<body>
<p>This is some text</p>
</body>
</html>
And here is a screenshot of what the browser uses:
(Sorry, don't have enough reputation to insert a real image)
This is all fine except when I want to use link to link an icon to the page, and it won't display unless it's in the head (I used the browser's dev tool and literally dragged the link up to the head and watched it appear immediately)
I've checked the source using the browser's developer tool and it looks exactly the same as in my code editor, so I know my web server isn't messing with it.
It does the same in Chrome and Firefox. It appears that they both use the head for script when a browser extension decides to put it there, but it does this even with no browser extensions.
I have tried the Notepad++ Encoding -> Convert to UTF-8 trick to remove the BOM character which supposedly fixes my issue but that did no good.
So how can I make the web page display as I wrote it?
Here is a download link to the file with the code snippet seen above:
http://www.filedropper.com/testpage_1
Thanks for any help!
Your Doctype is invalid. Error recovery is causing it to be treated as text. Since text is not allowed outside the body, it implies the start of the body element.
The correct syntax is:
<!DOCTYPE html>
The exclamation mark needs to be the second character.
This would have been picked up if you had used a validator.
I created a test page with your code and I can confirm that the developer tools show it like that. However, there is a typo in the DOCTYPE. Change the code to the following to fix it:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<p>This is some text</p>
</body>
</html>
The difference is that the exclamation mark needs to be before DOCTYPE, not after it. See The DOCTYPE in the HTML5 specification, which also points out that <!DOCTYPE html> is not case sensitive.
I had a client that gave a URL in a press kit before the website was done. He gave a page when I was making the website a one page site. So I took the URL he made and coded it as a redirect to scroll to that part of the site.
Now that I have it online, it isn't working properly.
fuzzripper.com/bio gives me an internal server error
fuzzripper.com/bio.html works just fine
I would like it to work even if the user doesn't type .html
Here is my redirect code
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="1; url=http://www.fuzzripper.com/#about">
<script type="text/javascript">
window.location.href = "http://www.fuzzripper.com/#about"
</script>
<title>Page Redirection</title>
</head>
<body>
<!-- Note: don't tell people to `click` the link, just tell them that it is a link. -->
If you are not redirected automatically, follow this <a href='http://www.fuzzripper.com/#about'>link</a>.
</body>
</html>
A quick fix for static sites is to
Create a /bio folder
Move bio.html in bio folder
Rename bio.html to index.html
This should make the bio#about link work just fine.
I've a text as Bharat written in hindi in PDF.
I am creating a web page where in i need to display this as it is in my webpage. when trying to copy the content and paste it is getting rendered as some garbled text. I've installed the corresponding font and when seen in ms-word it is showing correct, can you please let me know how can i show/display it as it is.
I get the below when i paste it directly.
fpfdRlh;
Thanks
Make sure you save the files as using UTF-8 encoding. Also use UTF-8 as the webpage's charset in the head.
<meta charset="utf-8" />
EDIT: I just tried this and it works great for me. Could it be a browser issue?
Code I tried for reference:
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<h1>देवना</h1>
</body>
</html>
And a JsFiddle for you: http://jsfiddle.net/zuymyz00/
I am trying to display an image (gravatar), but the ampersand in its link seem to be problematic.
At first, I had:
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>& in url</title>
</head>
<body>
Link to image
<img src="http://www.gravatar.com/avatar/f14e8ce12e7d7ffc11fe8a29127030da.jpg?d=mm&r=r" alt="display image">
</body>
</html>
The link (<a>) works fine this way, but the image (<img>) won't show. And of course it doesn't pass the w3c validation.
I encoded the ampersand to &, but the result stays the same (except for the w3c validation which is OK). I even tried a urlencoded version (via PHP) with no luck.
Any idea on what I am missing?
Edit: Nothing to do with encoding, this time. Ghostery (Firefox addon for privacy) was blocking gravatar images... Sorry guys and thanks for your help.
Your image is not dependent on URL parameters and it even works without any get parameters.
As It is mentioned in the comments, your problem is not with the URL, but with loading the content.