使用MathML标记网页 [英] Using mark of the web with MathML

查看:188
本文介绍了使用MathML标记网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序在用户计算机上创建MathML文档,我希望它们能够使用Internet Explorer打开。为了做到这一点,你必须下载 MathML播放器。这可以正常工作,但每次用户尝试打开文档时,都会显示一条标题:


为了保护您的安全, Internet Explorer已限制此网页运行可以访问您计算机的脚本或ActiveX控件。点击此处查看选项...


我已经做了一些研究,看来Microsoft认可的解决方法是添加网络标志(MOTW)的文件。 关于此主题的微软网页声称它可以使用xml文件:
$ b


从用于Windows XP Service Pack 2(SP2)的Microsoft Internet Explorer 6开始,您还可以将注释添加到多部分HTML(MHT)文件和XML文件。

然而,我必须使用一个.xhtml文件才能使mathml标记正确显示。这里是一个示例文件:

 <?xml version =1.0encoding =utf-8?> 
<! - 从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-数学svg.dtd>

< html>
< head>
< title>网络示例标记。< / title>
< / head>
< body>
< p> Hello,World< / p>
< math>< msup>< mi> f< mi> 2< / mi>< / msup>< / math>
< / body>
< / html>

当它以.html扩展名保存时,它不会正确显示MathML,但它会来在互联网区域。当它以.xhmtl扩展名保存时,MOTW不起作用,它会出现在本地区域中。但是,当您允许ActiveX运行时,它将正确显示。根据W3验证人(由于垃圾邮件限制,我不能包含链接)当文件使用.xhtml保存时没有警告,但是当它以.html扩展名保存时,会有一个警告。所以我相信.xhtml是正确的扩展名。



有什么办法可以让用户使用这个工作,或者我必须要求他们改变他们允许活动内容在我的电脑上的文件中运行的安全设置如果他们有权限,或者每次只需点击横幅,如果他们没有?

解决方案

MathPlayer在IE8及更早版本中使用MIME过滤器将XHTML转换为HTML,因为IE不知道HTML。虽然MIME过滤器不会删除注释,但可能是该过程中的某些操作。但是,MIME过滤器不能运行IE9,因为IE9理解XHTML。但是MOTW仍然无法在那里工作。

您有三种选择:


    <如果你只关心在IE浏览器中看到你的结果的用户,你可以生成HTML4并在文档的头部包含以下内容:

     < object id =MathPlayerclassid =clsid:32F66A20-7614-11D4-BD11-00104BD3F987>< / object> 
    <?import namespace =mimplementation =#MathPlayer?>

    您仍然需要MOTW


  1. <如果您只关心支持HTML5的IE9和更现代版本的浏览器,请使用以下方式启动您的文档:

     < ;! doctype html> 

    其中说这是一个HTML5文档。这将适用于Firefox和IE9。在IE9中,似乎不需要在这种情况下使用MOTW。

  2. 如果你想要在所有浏览器中有效的东西,可以使用 MathJax 。要使用MathJax,请包含一行,如

     < script type =text / javascript
    src =http ://cdn.mathjax.org/mathjax/latest/MathJax.js配置= MML_HTMLorMML>
    < / script>

    放在文档头部。有很多MathJax配置选项。有关更多信息,请参阅 MathJax文档。 MathJax的缺点是它比其他选项慢,需要连接到互联网。您可以通过配置选项将其推迟到MathPlayer(默认设置)或Firefox,并且可以加快速度。然而,如果您使用MathPlayer进行渲染,MOTW似乎无法正常工作。


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?

解决方案

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.

这篇关于使用MathML标记网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆