5

I want to know if i develop a visual web part, can i use html 5 tags in .ASCX file without adding any link to source or making changes to master page ?

4

The doctype of the default master pages isn't for HTML5 so I doubt it, you would need to set up a new master page (even a duplicate of the built in ones) with the correct doctype to use HTML5.

You also have to then be wary of the CSS implementation as the master page normally forces IE10 compatibility but this could be resolved when you create your HTML5 master page.

I know of other issues - people picker not working when using newer browsers in SP2010 - not sure if its still an issue in 2013.

  • I'm sorry but this information is incorrect for SharePoint 2013, where default mode is actually IE=10, and it does support HTML5 Quirks mode! – Marius Constantinescu - MVP Jan 10 '14 at 11:33
  • Thanks C. Marius I've updated my answer with the IE 10 info, however if you are using HTML5 you should specify the correct doctype. – Mauro Jan 10 '14 at 13:07
2

SharePoint 2013 out-of-the-box (both publishing or collaboration) has and "X-UA-Compatible = IE=10", see picture from my Office 365 siteenter image description here

Ideally it should be (e.g. IE=edge specifies to use the latest compatibility mode supported by your IE browser, which also by having IE=10 means support HTML5 Quirks mode - http://msdn.microsoft.com/en-us/library/hh869300(v=vs.85).aspx). To test it use any of the HTML5 specific tags, such as CANVAS, etc. and see if it simply works - put in a CEWP

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

Have a look at this also http://msdn.microsoft.com/en-us/library/jj676915(v=vs.85).aspx

  • I think we are confusing two very different things here. From the image above, using HTML5 tags is certainly NOT correct, because the DOCTYPE used is for XHTML1.1. What the browser manufacturer is doing to actually correct this kind of developer mistakes is another story. The correct thing to do is use tags that validate against the declared DOCTYPE. – yandr Jan 10 '14 at 12:55
  • XHTML 1.1 declaration does NOT forbid HTML5! it simply adds more strictness (read more here demosthenes.info/blog/251/…) which in the case HTML 5 are laxed! – Marius Constantinescu - MVP Jan 10 '14 at 13:08
  • 1
    HTML5 and XHTML1.1 are two different things. When you are sending the document to the browser, you are effectively saying "Hey, this is my code and you can validate it against HTML5" or "Hey, this is my code and you can validate it against XHTML1.1". You can't say both. Because most people do not know what the doctype actually is, the browsers are trying their best to correct all these inconsistences (HTML5 tags in XHTML documents and vice versa). However it is wrong and can lead to strange display problems. – yandr Jan 10 '14 at 15:01
-1

Do not use HTML5 tags if the DOCTYPE in your master page is XTML1.1.

Otherwise, you are just begging for trouble which can arrive in unexpected ways and places.

  • 1
    Care to elaborate? – iOnline247 Jan 10 '14 at 14:40
  • There is really too much information about DOCTYPES out there and this issue is not really related to Sharepoint, but HTML and web development in general. You can look at webdesign.about.com/od/dtds/a/aa071007.htm but there are many resources. Try DOCTYPE, Quircks mode, sniffing keywords – yandr Jan 10 '14 at 15:07
  • So what you are saying is clear. Using HTML5 elements with a DOCTYPE that isn't <!doctype html> is "begging for trouble and unexpected ways and places." Can you elaborate on your experiences of what those things are? – iOnline247 Jan 10 '14 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.