nsIWebNavigationInfo 编辑
docshell/base/nsIWebNavigationInfo.idl
Scriptable Exposes a way to get information on the capabilities of Gecko web navigation objects. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISupports
Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)Implemented by: @mozilla.org/webnavigation-info;1
as a service:
var webNavigationInfo = Components.classes["@mozilla.org/webnavigation-info;1"] .getService(Components.interfaces.nsIWebNavigationInfo);
Method overview
unsigned long isTypeSupported(in ACString aType, in nsIWebNavigation aWebNav); |
Constants
Support type constants
Constant | Value | Description |
UNSUPPORTED | 0 | Returned by isTypeSupported to detect whether a type is supported at all. |
IMAGE | 1 | Returned by isTypeSupported() to indicate that a type is supported as an image . |
PLUGIN | 2 | Returned by isTypeSupported() to indicate that a type is supported via an NPAPI ("Netscape 4 API") plug-in. This is not the value returned for "XPCOM plug-ins". |
OTHER | 1 << 15 | Note: Other return types may be added here in the future as they become relevant. Returned by isTypeSupported() to indicate that a type is supported via some other means. |
Methods
isTypeSupported()
Determines whether or not the specified MIME type is supported by the given nsIWebNavigation
object. This lets you determine whether a MIME type can be displayed as-is inside a browser, or if the browser will instead forward handling of the data to a plug-in or an external helper application.
unsigned long isTypeSupported( in ACString aType, in nsIWebNavigation aWebNav );
Parameters
aType
- The MIME type to check.
aWebNav
- The
nsIWebNavigation
object on which to check for compatibility. You may specifynull
to check for compatibility withnsIWebNavigation
objects that are in their default state; otherwise, the result is determined based on the configuration of the specified object (that is, how it is configured by usingnsIWebBrowserSetup
).
Return value
Returns one of the Support type constants, indicating whether or not the specified MIME type is supported, and in what form that support exists.
Example
let webnavigationinfo_service = Components.classes["@mozilla.org/webnavigation-info;1"]
.getService(Components.interfaces.nsIWebNavigationInfo);
let support_code = webnavigationinfo_service.isTypeSupported(contentType, null);
if (support_code == webnavigationinfo_service.UNSUPPORTED) {
dump("Unsupported content-type: not displaying in the browser\n");
}
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论