MIP verification rules


MIP verification rules

The MIP page will have strict standard verification, and no problems that fail the verification are allowed.

MIP verification tool address: https://www.mipengine.org/validator/validate

This document is intended to help developers find the content and rules of verification and quickly locate the reasons for failed verification

MIP HTML tags and attribute errors

1. Missing mandatory tags

QQ截图20170204105436.png

##In MIP HTML, mandatory tags include:

QQ截图20170204105531.png

P.S.: When the meta tag name="viewport" is used, the value of content must contain at least width=device-width, minimum-scale=1 and initial-scale=1. Properties and the order is not fixed.

2. Disabled tags

QQ截图20170204110129.png

Most HTML tags are allowed to be used. For tags that are disabled or need to be replaced, please refer to:

MIP HTML Specification

3. Invalid attribute value

QQ截图20170204110151.png

When the html tag has an incorrect attribute value, this error will be reported. Things to note in mip are:

  • a: The href attribute does not allow the use of javascript: protocol,

  • a: The target attribute needs to be set to

    _blank

  • mip-img

      src: must be a url
  • mip-pix

      src: must be an address url that supports https.
    • If you choose the https proxy provided by Baidu Cloud, the url should contain "t={TIME}&title= {TITLE}&host={HOST}&from=baidu"
  • Other basic HTML page attribute specifications remain unchanged

Note:
1. The url in MIP HTML is forced to be https
2.
<a>Tag:

-
<a href="javascript:xxx()"></a> wrong
-
<a href="//m.sbmmt.com/m/html5/xxx" target="_blank"></a> Right

4 .Invalid value of attribute value

QQ截图20170204110306.png

Invalid value of attribute value may occur:

  • <meta name ="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">

    • width attribute value device-width
    • initial-scale attribute value 1
  • #<script type="application/ld+json"></script>

  • ##<script type="application/json"></script>

    In addition to the js required for external link MIP , the type attribute value of the script tag should be application/ld+json or application/json
    ##Note:
  • 1. Except for the values ​​given above, all Invalid value
5. Missing mandatory attributes

For example, mip-img and mip-pix in mip html have mandatory attributes src:QQ截图20170204110335.png

mip-img

    src
    • mip-pix
  • src
    6. Direct parent tag error

Some tags have specified direct parent tags. The following example gives the direct parent tag that each tag must have: QQ截图20170204110355.png

  • !doctype's direct parent tag is root
  • head's direct parent tag is html## The direct parent tag of
  • #body is html
  • The direct parent tag of link is head## The direct parent tag of
  • #meta
  • is head## The direct parent tag of style mip-custom
  • is
  • The direct parent tag of headstyle
  • is
  • boilerplate7. Illegal parent tag

For example: The sub-tag of QQ截图20170204110416.png

<body>
    is written in
  • <head> 8. Force parent tag

QQ截图20170204110434.pngimg must be a child tag of noscript

    video must be a child of noscript Level tag
  • audio must be a child tag of noscript
  • When noscript is used in head, it must be the last child node of head , there are no restrictions on noscript in the body
  • 9. Duplicate unique tags

In a piece of html, some tags are unique , that is to say, it can only appear once. When there are duplicate unique tags in the html, an error should be reported. QQ截图20170204110507.png

The following is a list of unique tags:

    <doctype html>
  • <html mip>
  • ##<head>
  • ##<link rel= "canonical" href=...>
  • ##<meta charset="utf-8">
  • <meta viewport>
  • ##<style mip-custom>
  • <body>