Can you use https in HTML doctype declarations? - doctype

I am wondering if you can use https in HTML doctype declarations? For example, w3.org lists different declarations, all of which have http and not https
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
I have not seen a doctype declaration with https (although, the sample size is small for me). Is there any reason why this remains as http? I am assuming the URI gets mapped to https anyways so it's just a cosmetic thing, but why is this still http?

I'd recommend you use HTML5's <!DOCTYPE html> (listed at the w3.org page you linked), but the older declarations are historical curiosities that don't present a security problem. Browsers don't use that http://... string that appears in the DOCTYPE tag as a URL to load; it's just a way to declare what standard the author intended to follow.

Related

Doctype for html email

Which DOCTYPE is the right one for HTML email?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
There is only minor differences these days in DOCTYPE declarations in html email. Although only minor, it is still recommended to test your emails via Email on Acid or Litmus or any other testing software prior to a send to ensure cross client compatibility and to find any unforeseen quirks.
The larger issues comes with if you do not declare a doctype or body tag, it can really screw up different parts of the email on certain clients.
The most popular DOCTYPE nowadays is the HTML 5 doctype (<!DOCTYPE HTML>) which is used with very little hiccups. The most popular/safest doctype used to be the <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> doctype. This can still be used, but may limit different capabilities of your email, as it is referencing an older version of HTML.
See this forum post in litmus for more in-depth information on this: https://litmus.com/community/discussions/39-explanation-of-doctype-html-attributes-and-meta-tags-in-email-head
This is what I use.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
I code emails daily and this came as the header that exact target (salesforce) provided us. Our company has sister brands and this what they all use as well so I'm assuming this is standard.
More primitive email readers cannot handle DOCTYPE at all, and instead either strip it completely out of the email, or just remove the string "!DOCTYPE" and leave the rest of the HTML intact. You wind up seeing weird things like this at the beginning of the emails:
< HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
...because the word !DOCTYPE was removed, but not the rest, and since it did not remove the space, it displayed the broken code to the reader.
The rest of the email will usually display just fine.
While this obviously is a programming error by the writer of the script, I have seen a lot of scripts with this same exact error. It's usually because they are simply stripping out HTML tags and not allowing !DOCTYPE.
Email clients seem to be able to process your email without it unless you are using a different character set than the user, and sometimes stumble when you declare it.

Facebook meta tags issue - debugger says not in the <head> tags

I have an issue with facebook, longer period of time the meta tags are not working on my website. The title is showing perfectly on facebook, however the image doesn't. Also, when I go through fb debugger, it says: Your page has meta tags in the body instead of the head. This may be because your HTML was malformed and they fell lower in the parse tree.
Please fix this in order for the tags to be usable.
My website is: http://www.popularno.mk/, but this error message also comes up at every single post (example: http://www.popularno.mk/2013/07/27/vozila-grcija/)
I'd be very grateful for a solution.
Regards,
There is a Byte-Order Mark that seems to be messing things up for the debugger.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><body>
<p>
You may want to deal with removing that from your code before proceeding further.

HTML Emails appear blank in Yahoo

Im trying to install a good newsletter script for some basic email marketing. The thing is that my yahoo just dont want to display HTML emails. I sent some html test emails to myself through several scripts and from my yahoo account aswell,but all appear blank.
It's quite odd because my magento's html emails are being received correctly,but others [ and even YAHOO emails! ] arent.
Does anyone know why is this happening?
Changed the content type and encoding in the settings for each of the velocity templates to HTML / UTF-8
Added a to each of the emails with the standard charset="UTF-8" declaration. Maybe Yahoo doesn't strip out the head like most other email clients.
Added the HTML 4.01 strict declaration to the top of the email:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
I just ran into this problem myself.
Here is what I found:
Older article, but still useful:
they recommend:
<!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN'
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
Which seems to work for everyone except Yahoo.
Instead, use the following for Yahoo:
<!doctype html>

Open Graph namespace declaration: HTML with XMLNS or head prefix?

I have seen conflicting information on how to best implement Open Graph namespaces. Specifically, the Open Graph website uses a few different methods, and the Facebook Open Graph examples use other methods.
Open Graph website example (using HTML prefix attribute):
<html prefix="og: http://ogp.me/ns#">
Open Graph website source code (using HTML XMLNS attribute):
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#">
Facebook Open Graph documentation (using HEAD prefix attribute):
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
Facebook Open Graph documentation #2 (using HTML XMLNS attribute):
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#"
xmlns:fb="https://www.facebook.com/2008/fbml">
What is the recommended method or does it not even matter?
They are all equivalent and will all work.
Use prefix as it is the new recommended way and is fewer characters.
I'll get all our documentation updated to prefix.
I tried following #Paul Tarjan's answer of using prefix in the head. However I got some Internet Explorer 8 issue. So in the end I still use the xmlns way for fb namespace:
<!DOCTYPE HTML>
<html xmlns:fb="http://ogp.me/ns/fb#">
<head prefix="og: http://ogp.me/ns# object: http://ogp.me/ns/object#">
It doesn't even matter. RDFa Core Initial Context recognizes og as a widely used vocabulary prefix:
RDFa users can use these prefixes without having the obligation of defining the prefixes in the HTML code. The same list of prefixes have also been defined for JSON-LD as a JSON-LD Context at the URI http://www.w3.org/2013/json-ld-context/rdfa11; JSON-LD users can use the #context key with that URI as a shorthand to use the same prefixes.
Emphasis added for clarity.
Therefore, you do not need to add a namespace to your HTML documents. More information here.
<html xmlns="http://www.w3.org/1999/xhtml" prefix="og: http://ogp.me/ns# fb:
http://www.facebook.com/2008/fbml"> <head>
There is the best way to validate.
prefix/xmlns attribute is useful to define short-hand. rdf is from xml lineage so xmlns notation should be expected to work independent of doctype detail. rdfa extends html with attributes including prefix as given by http://www.w3.org/TR/rdfa-in-html/#extensions-to-the-html5-syntax
However, this requires adhering to http://dev.w3.org/html5/rdfa/rdfa-module.html
Also, the tool support for rel="profile" as mentioned therein is as yet awaited. Till then, the choice is between using older doctypes, or manually placing rdf: for validation purpose or wait for validator & such tools to catch-up. The right place to make declaration is any element opening tag which is ancestor of wherever the short-hand notation will be used. Specifically for the case of og prefix, its predefined by the initial context of RDFa Core http://www.w3.org/2011/rdfa-context/rdfa-1.1.html so skipping it altogether for newer doctypes is alright. And specifically for html5 the RDFa initial context http://www.w3.org/2011/rdfa-context/html-rdfa-1.1 is loaded only after the RDFa initial context mentioned earlier.

Facebook Connect Won't Validate

I'm trying to get my Facebook Connect code to validate, but it won't. I think the problem is that their xmlns page isn't loading. I have the code:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en" lang="en">
But http://www.facebook.com/2008/fbml isn't found. Does anyone have a copy of what it should be? Is there a different URL i should use?
The XML namespace doesn't need to actually exist, they are just a way to qualify elements and attributes. If you're interested (this is unrelated to your issue), there is more about XML namespaces here
Facebook seems to have a pretty straightforward page setup here: FB Connect, and it's laid out step by step. Have you checked this out?
As already mentioned, the namespace URL is a red-herring. It's the DTD (as specified in the DOCTYPE) that is validated against.
If you really want to validate your pages that use XFBML, you will need to validate against a custom DTD. And, as far as I'm aware, Facebook don't publish a DTD for XFBML themselves, so you'll have to write one yourself (probably only for the elements/attributes that you're actually using).
It's not actually as tricky as it sounds; here's an A List Apart article on how to validate against a custom DTD.
Note also that messing around with your DOCTYPE declaration may do funny things with regards to knocking (older) browsers into quirks mode.
So you can get it to validate; it's just up to you whether it's worth the hassle.
Facebook XHTML does not validate.
XFBML - why did they have to be different? Nobody will care enough to petition them on this until a couple years from now and then W3C will re-write their standard to include XFBML or Facebook will be forced to re-write in a more compatible format. Why not use ID's or rel attributes to make their script work? That would allow a 100% valid format that would play nice with all browsers and CMS out there. Maybe they were worried about blog pages without root access making FB-based scams?