Using mark of the web with MathML

試著忘記壹切 提交于 2019-12-11 18:28:11

问题


I have a program that is creating MathML documents on users computers that I would like them to be able to open with Internet Explorer. In order to do this you have to download the MathML player. This works fine, but every time the user tries to open a document they are shown a banner that says:

To help protect your security, Internet Explorer has restricted this webpage from running scripts or ActiveX controls that could access your computer. Click here for options...

I have done some research and it appears the Microsoft approved way of getting around this is to add the "Mark of the web" (MOTW) to the document. The Microsoft page on this topic claims that it will work with xml files:

Beginning with Microsoft Internet Explorer 6 for Windows XP Service Pack 2 (SP2), you can also add the comment to multipart HTML (MHT) files and to XML files.

However I have to use a .xhtml file in order for the mathml markup to appear correctly. Here is a sample file:

<?xml version="1.0" encoding="utf-8"?>
<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">

<html>
  <head>
    <title>A Mark of the Web Example.</title>
  </head>
  <body>
     <p>Hello, World</p>
<math><msup><mi>f</mi><mi>2</mi></msup></math>
  </body>
</html>

When this is saved with a .html extension it does not display the MathML correctly, but it does come up in the Internet zone. When it is saved with a .xhmtl extension the MOTW doesn't work and it comes up in the local zone. However, when you allow the ActiveX to run it will display correctly. According to the W3 validator (I can't include a link due to spam restrictions) when the file is saved with a .xhtml there are no warnings, but when it is saved with a .html extension there is one warning. So I am confident that .xhtml is the correct extension.

Is there any way I can make this work for the user, or will I have to require them to change their security settings for "Allow active content to run in files on My Computer" if they have the permissions or just click on the banner every time if they don't?


回答1:


MathPlayer uses a MIME filter in IE8 and earlier versions to convert XHTML to HTML because IE doesn't know about HTML. Although the MIME filter doesn't remove comments, perhaps something in the process does. However, the MIME filter does not run for IE9 because IE9 understands XHTML. But the MOTW still doesn't work there.

You have three options:

  1. If you only care about users seeing your result in IE, you can generate HTML4 and include the following in the head of the document:

    <object id="MathPlayer" classid="clsid:32F66A20-7614-11D4-BD11-00104BD3F987"></object>
    <?import namespace="m" implementation="#MathPlayer" ?>
    

    You still need the MOTW

  2. If you only care about IE9 and more modern versions of browsers that support HTML5, start your document with:

    <!doctype html>
    

    which says that this is an HTML5 document. That will work for Firefox and IE9. In IE9, it appears that the MOTW is not needed in this case.

  3. If you want something that works in all browsers, use MathJax. To use MathJax, include a line like

    <script type="text/javascript"
            src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=MML_HTMLorMML">
    </script>
    

    in the head of your document. There are lots of MathJax configuration options. See the MathJax documentation for more information. The downside to MathJax is that it is slower than the other options and requires being connected to the internet. You can make it defer to MathPlayer (the default) or to Firefox via configuration options, and that speeds it up a lot. However, the MOTW doesn't seem to work if you have MathPlayer render it.



来源:https://stackoverflow.com/questions/9894906/using-mark-of-the-web-with-mathml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!