检测MATLAB帮助浏览器 [英] Detect MATLAB Help Browser

查看:182
本文介绍了检测MATLAB帮助浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为大型MATLAB应用程序创建一些HTML文档,主要在11b以后的任何版本的MATLAB中都可以在MATLAB帮助浏览器中进行查看.这将有一些自定义CSS(但没有什么非常复杂的).

I'd like to create some HTML documentation for a large MATLAB application, to be viewed mainly within the MATLAB Help Browser, in any version of MATLAB from 11b on. This would have some custom CSS (but nothing very complicated).

但是,我也希望在其他浏览器中也可以看到相同的文档.我会关心Chrome,IE9和10,尽管会支持其他浏览器.我希望文档

However, I'd also like the same documentation to be viewable within other browsers. I care about Chrome and IE9 and 10, although support for other browsers would be welcome. I'd like the documentation to

  1. 在包括MATLAB帮助浏览器在内的所有浏览器中看起来基本相同,但是
  2. 在MATLAB帮助浏览器中显示时,在某些方面看起来有所不同-特别是,我希望显示matlab:链接并使其行为有所不同,因为在MATLAB帮助浏览器外部不支持它们.
  1. Look essentially the same across all the browsers including the MATLAB Help Browser, but
  2. In a few ways look different when presented in the MATLAB Help Browser - in particular, I want matlab: links to be displayed and behave differently, as they are not supported outside the MATLAB Help Browser.

问题1:即使我的CSS很简单,MATLAB帮助浏览器在支持CSS的哪些部分上也似乎无法预测,即使使用1,我也遇到了困难.在MATLAB版本中有很多.我猜它根本没有记录在案.是否有人对在MATLAB帮助浏览器中使用CSS有任何经验/提示?

Question 1: I'm running into difficulty even with 1, as despite the simplicity of my CSS the MATLAB Help Browser seems unpredictable in what parts of CSS it supports, and it seems to vary a great deal across MATLAB versions. I'm guessing that it's not documented at all. Does anyone have any experience/tips about using CSS in the MATLAB Help Browser?

问题2:我希望能够以某种方式自动检测查看浏览器是否支持matlab:协议,但是从浏览其他StackOverflow答案看来,这是不可能的.考虑到我需要支持Chrome,甚至不可能尝试跟随matlab:链接并检测其是否失败,因为显然Chrome会以静默方式失败.嘘因此,我的下一个想法是使用JavaScript检测浏览器的UserAgent. MATLAB 11b将其自身报告为带有ICEbrowser的Mozilla4.0,而13a则将其声明为带有Trident6的Mozilla4.0.我不确定这些是什么-我猜它们是基于第三方Java的浏览器组件,其行为类似于Mozilla,而MathWorks已在11b和13a之间更改了该组件.

Question 2: I was hoping to be able to auto-detect somehow whether the matlab: protocol was supported in the viewing browser, but it seems from browsing other StackOverflow answers that this is not possible. Given that I need to support Chrome, it's not even possible to try following a matlab: link and detect if it fails, as apparently Chrome fails silently. Boo. So my next thought is to use JavaScript to detect the UserAgent of the browser. MATLAB 11b reports itself as Mozilla4.0 with ICEbrowser, whereas 13a gives Mozilla4.0 with Trident6. I'm not entirely sure what these are - I'm guessing they're third-party Java-based browser components that behave like Mozilla, and MathWorks have changed the component between 11b and 13a.

如果我检测到UserAgent并假定包含字符串ICEBrowserTrident的任何内容,是否足以在大多数情况下区分MATLAB帮助浏览器?显然,对于13a后的发行版,我必须保持与UserAgent字符串同步.

If I detect the UserAgent and assume that anything containing the strings ICEBrowser or Trident, is that likely to be sufficient to distinguish the MATLAB Help Browser for most purposes? Obviously I'll have to keep up to date with UserAgent strings for post-13a releases.

感谢您的建议!

推荐答案

MATLAB帮助浏览器的功能差异很大,不仅在不同的MATLAB版本之间,而且在不同的操作系统之间,甚至在不同的体系结构之间(最近的64位版本)通常使用的浏览器特别糟糕.

The capabilities of the MATLAB help browser differ greatly, not only between different MATLAB versions, but also between different operating systems and even between different architectures (the recent 64bit versions often have a particularly bad browser).

我们正在使用用户代理来交付特定于MATLAB的网页.这是其中一些的列表:

We're using the user agent to deliver MATLAB-specific web pages. Here's a list of some of them:

R2010b/R2011b, 32bit, WinXP:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20060705

R2010b/R2011b, 32bit, Win7:
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.8) Gecko/20060705

R2010b, 64bit, Win7:
Mozilla/5.0 (Java 1.6.0_17; Windows 7 6.1 amd64; de_DE) ICEbrowser/v6_0_2

R2011b, 64bit, Win7:
Mozilla/5.0 (Java 1.6.0_17; Windows 7 6.1 amd64; de_DE) ICEbrowser/v6_0_2

R2012a, 32bit, Win7:
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko

R2012a, 32bit, WinXP:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko

R2012a, 64bit, Win7:
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2;     .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; Tablet PC 2.0)

R2012b, 32bit, Win7:
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko

R2012b, 64bit, Win7:
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2;     .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; Tablet PC 2.0)

R2010b, 32bit, Linux:
Mozilla/5.0 (Java 1.6.0_17; Linux 2.6.32-33-generic i386; en_US) ICEbrowser/v6_0_2

请注意,您不能简单地对此进行字符串比较,因为字符串的某些部分会根据客户端计算机(例如语言代码)而变化.

Note that you cannot simply do a string comparison against these, since some parts of the strings change depending on the client machine (e.g. the language code).

还请注意,除了呈现HTML和CSS之外,其他功能也有很大差异.特别是,对JavaScript和HTTP身份验证的支持.

Also note that other capabilities besides rendering HTML and CSS differ greatly. In particular, support for JavaScript and HTTP authentication.

这篇关于检测MATLAB帮助浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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