How to show all plugins from Internet Explorer? - javascript

I am having some troubles on listing the plugins from IE plugins using Javascript like Panopticlick does.
I am using the plugin.name but it does not run on IE
Any suggestions or used code examples? Thank you

navigator.plugins will work for IE 11 but not for earlier IEs. More on IE and plugins can be read here. For earlier IEs, you will need to check for each plugin manually by trying:
try {
new ActiveXObject('aPluginName');
return true;
} catch(e) {
return false;
}
Main problem is, that plugins in IE are ActiveX based, which means each has its own API and there is no way you can check this in a general "catch-them-all" way. I found this link quite helpful.

Related

object is null or undefined error in IE9

So I followed some tutorials for uploading files asynchronously. The project runs fine for Mozilla Firefox and Chrome, but when i run it in Internet Explorer 9 it gives an error:
0x800a138f - Microsoft JScript runtime error: Unable to get value of the property 'length': object is null or undefined
here is where it shows the error:
<script type="text/javascript">
$(document).ready(function () {
$("#btnUpload").click(OnUpload);
});
function OnUpload(evt) {
var files = $("#fileUpload").get(0).files;
if (files.length > 0) { <---//Error
...
I have already tried some fixes e.g adding this to the head tag
<head>
<meta http-equiv="X-UA-Compatible" content="IE=9" >
This doesn't work for me.
So help would be greatly appreciated.
You haven't specified what jQuery plugin you're using for the file upload, but my guess is that it's one which is using a browser feature (File API) that isn't available in older browsers like IE9.
There are ways of uploading files using old browsers; if you want to support IE9, you'll have to use one of the older techniques.
You might want to look at some of the libraries listed here -- this is a list of "Polyfill" libraries which claim to allow some degree of compatibility for this new feature in older browsers. I can't guarantee that any of them will work nicely with your existing jQuery plugin, but they should at least give you a starting point for getting the feature working.

how to detect browser supports HTML5 microdata API

I use the following code to check for HTML5 microdata API support
function supports_microdata_api() {
return !!document.getItems;
}
but this is not working properly. How can I solve this problem?
Use Modernizr, so you can test it like this:
if (Modernizr.microdata) {
// Yay, microdata is supported!
}
Nonetheless Chrome and Safari don't seem to support this semantic syntax anymore.

regex not working in IE

IE version 8
The regex is working fine in firefox:
filename variable contains: testfile.arv (see invalid extension)
if (/\.(doc|xls|ppt|eml|txt|pdf|rtf).?\b/i.test(filename)) {
...
}
in IE it simply passes out as valid name.
EDIT:
After I changed the expression as suggested below. it continued to fail - in IE only. made me realize that it is not about this expression but something about IE and the javascript module I am using to do this.
I am using http://malsup.com/jquery/form/ this form plugin to upload multiple files. this is working properly on firefox, but is not working on internet explorer. it just simply uploads everything and does not show upload progress etc.
since this problem is turning out to be different I will close this thread and submit new question.
Thx for everyone's time and sorry for trouble. I am finding this porting thing a little difficult (from firefox to IE)
try ending it with an "$", like so
if (/\.(doc|xls|ppt|eml|txt|pdf|rtf)$/i.test(filename)) {
// super awesome code
}

Detect version of the plugin in Chrome browser

I have NPAPI plugin and I want to detect its version before I embed it into web page. If version is not the latest one I want to show some message that asks users to update the plugin.
Now it's implemented in the following way
if (navigator.mimeTypes && navigator.mimeTypes["application/myplugin"]) {
{
// some code here
if(navigator.plugins["myplugin"] && navigator.plugins["myplugin"].version >= latest_version) {
// we have the latest version (embed the plugin into web page)
document.write ("<object id='plugin'><embed ....></object>");
} else {
document.write ("Show message here");
}
// some code
}
The problem is that navigator.plugins["myplugin"].version works fine in Firefox but not in Chrome. Chrome doesn't expose version property. I can add my own property in NPAPI code, but I don't see the way I can use it before embedding the plugin into page.
Is there any workaround?
Thanks in advance, Andrew
I see a lot of plugins have version information in either the name or the description. You should be able to access that information before the embed.
I actually put the version number in the filename, rather than even the name or description. The reason for this is that if there are multiple plugins with the same name, description, and mimetypes Firefox will generally use the latest version. Older versions of firefox have been inconsistent in how they handle this, so I even usually put the np???_version.dll file in a version-specific subdirectory.
It is a little bit of a pain, but it works consistently the same way in every NPAPI browser.
You can create a JSAPI property of your plugin containing the version. This property returns the plugin's version when called from javascript. So when you try to insert/embed the plugin in the page, you can check through javascript to make the appropriate calls.

webservice.htc, moz-behaviors and Firefox 3

Whilst trying to get our app working in Firefox (I'm a big proponent of X-Browser support but our lead dev is resisting me saying IE is good enough). So I'm doing a little side project to see how much work it is to convert.
I've hit a problem straight away.
The main.aspx page binds to a webservice using the IE only method of adding behaviour through a htc file, which is auto-generated by VS I beleive.
Firefox doesn't support this but there is an xml bindings file which can be used to enable htc support (see here: http://dean.edwards.name/moz-behaviors/overview/). The examples work in FF3 but when I use my webservice.htc as I normally would e.g.:
//Main.aspx
/*SNIP*/
<style type="text/css" media="all">
#webservice
{
behavior:url(webservice.htc);
-moz-binding:url(bindings.xml#webservice.htc);
}
</style>
</head>
<body>
<div id="webservice"></div> <!-- we use this div to load the webservice stuff -->
/*SNIP*/
//Main.js
webservice.useService(url + asmpath + "/WebServiceWrapper.asmx?WSDL","WebServiceWrapper");
I get webservice is not defined (works fine in IE), I obviously tried
var webservice = document.getElementById("webservice")
and
$("#webservice").useService(url + asmpath + "/WebServiceWrapper.asmx?WSDL","WebServiceWrapper");
as well which just gives me "useService is not defined" in Firebug. Which leads me to beleive that the binding is not working. However I can see that webservice.htc is being loaded by Firefox in the Firebug console window.
Anyone got any experience of this?
Am I going to have to rewrite how the webservice is called?
Cheers,
Rob
I don't think that you are on the right way for achieving real cross-browser compatibility. Adding support for IE-specific features for Firefox is definitely not the way to go. What about Opera, Safari, Chrome...? If the app you're working on is used strictly on the intranet then supporting Firefox may be enough however...
IMHO, the code should be refactored, but in an other way. If you are working with ASP.NET 2.0 (in this case you'd need ASP.NET Ajax) or newer, you can create proxy between Ajax and SOAP web services. In that case you would need to rewrite all your behaviors as a JavaScript code which may not be a small feat.
On a side note: AFAIK VS.NET does not generate behaviors.
Sorry if this is not too helpful :(
Your jQuery snippet has an error: since useService is a method defined on the node itself, not the jQuery object, you'd have to do:
$("#webservice")[0].useService(url + asmpath +
"/WebServiceWrapper.asmx?WSDL","WebServiceWrapper");

Categories