• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2888
  • Last Modified:

Prompt to ask to install ActiveX control in IE from web page

Hi, I want to do the same thing as http://www.adobe.com/products/shockwaveplayer/mountainbike_game/ where you click on an object and it asks to Install ActiveX control when you click on the object.

Does anyone know how to do this ?
0
Netlink2
Asked:
Netlink2
  • 10
  • 5
2 Solutions
 
b0lsc0ttCommented:
Netlink2,

What does your ActiveX object do?  The prompt you get is just part of the browser and not something initiated by the object.  Most objects will actually cause the browser to show the prompt.  The prompt isn't just the install (i.e. a download) but permission to the browser to use the object.

Is your object working but not showing a prompt?  Have you deleted the object from your browser (i.e. temporary internet files objects area)?  If not then you may not see a prompt because you have already given it permission to download (and thus run).

Let me know if you have any questions or need more information.

b0lsc0tt
0
 
Netlink2Author Commented:
Hi, the object works fine, but a major complaint we get is that the user doesn't notice the yellow bar at the top of the screen. if we can have a "click here" to show how to activate the control then that would be fine. Or find a way to remove the request altogether. I've tried taking the object and making it outerHTML with javascript to no avail as yet.

It's really just to make the users life easier and stopping so many support calls.
0
 
b0lsc0ttCommented:
Thanks for clearing up what you were asking or wanted.  There is no way for you as a developer to remove the need for that request or permission.  Obviously that would lead to a big security issue. :)
There is a good chance you can have something that will show if the object isn't loaded.  Javascript and the DOM lets you "test" for objects on the page.  A try/catch or just using script like ...
    if (!document.theObject) {
... could do this.  A new page or part of the page with the object that will have instructions would be a good idea.  Even though many know what to do that warning that it will be needed is helpful since many do miss it, as you pointed out.
I don't have a generic example of how to do this but might be able to come up with one or could provide more details if you provide some of your code for that part of the page.
Let me know if you have a question about this.
bol
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Netlink2Author Commented:
I suppose the idea isn't to remove the message, the idea was to be able to click on a box and then have the message appear in the box instead of at the top of the screen.

That's what they do at http://www.adobe.com/products/shockwaveplayer/mountainbike_game/ 

Did you get a chance to look at that site ?
0
 
b0lsc0ttCommented:
I did.  That isn't really a fair comparison though.  That file is an SWF file so would be handled differently from an ActiveX object.  After your last post I was curious to see what "different" method they could use and saw the big difference in situations.  There won't be any way for you to get a result like that without providing some customization to the browser itself (i.e. a BHO or some browser addon at the very least).
Let me know if there is anything else I can help on with this or other questions on what I have said.
bol
0
 
Netlink2Author Commented:
thanks for looking in to that.

I noticed that when I look at the site with DOM explorer that the element parameters are in there, I would have expected to see object parameters. So I thought there might be a trick to it.

In that case, could you show me an example on how to see if the object is there. Either by class or id would be preferable.

Thanks.
0
 
b0lsc0ttCommented:
A basic example is in my previous post.  Seeing what is in the DOM (i.e. the document.plugins collection) could be a way.  However from my experience this will depend on the object and even how it is loaded (i.e. the html).  Without that I can't be more specific.  There are a number of other examples on the web that can be found with a search though that work for various, common objects that may help you if you have some unique object and can't provide more info.
bol
0
 
Netlink2Author Commented:
Hi, I found another site that does the same thing. This time nothing to do with SWF. http://mobile.lgcare.co.kr/Citrix/MetaFrame/default/Win32WebClientDownload.aspx.

Can you see how they do it on this site ?
0
 
Netlink2Author Commented:
So I how do I detect if the object is loaded ?, for example my javascript code is:

document.writeln("\<OBJECT classid=\"clsid:12510606-30FA-11D2-F383-434553540000\"");

Also, when I give it an id it doesn't recognize it, i.e I can't see it in the DOM inspector. So I need to detect by classid, not id.
0
 
Netlink2Author Commented:
OK, Got the classid with
alert(document.getElementsByTagName("object")[0].classid);

I'll continue to investigate how to do the ActiveX prompt from within the object.
0
 
b0lsc0ttCommented:
The html in the page you provided doesn't make it clear if the object is ActiveX or not.  You would need to get info from them or download and look at the object, etc to find out.  The html isn't typical for an ActiveX object and if you get a different response or warning from the browser then I would say it is not ActiveX.
You might look at a tool called PageSpy if you want something to show you the DOM and what IE might be able to access with javascript.  That will help to know how to use the general suggestion I provided.  As I mentioned before I can't be specific on how to detect this object without more details.
Let me know if there is anything else I can provide or you have a question about what I have said.
bol
0
 
Netlink2Author Commented:
Thanks so much scott. The classid is true whether the object is loaded or not, so that didn't help at all.

But I did find another interesting site. http://developer.apple.com/internet/webcontent/examples/detectallplugins.shtml 

The catch with this site is that when I run their example it works fine, and yet when I use the provided source it shows the ActiveX display. Maybe Apple has deactivated this through one of their plugins or something ?

Any ideas what they've done here ?

Either way I'm stuck again :).
<html>
<head>
<script language="JavaScript">
// Copyright © 2000 by Apple Computer, Inc., All Rights Reserved.
//
// You may incorporate this Apple sample code into your own code
// without restriction. This Apple sample code has been provided "AS IS"
// and the responsibility for its operation is yours. You may redistribute
// this code, but you are not permitted to redistribute it as
// "Apple sample code" after having made changes.
 
<!--
// initialize a variable to test for JavaScript 1.1.
// which is necessary for the window.location.replace method
var javascriptVersion1_1 = false;
// -->
</script>
 
 
 
<script language="JavaScript1.1">
<!--
javascriptVersion1_1 = true;
// -->
</script>
 
 
<script language="JavaScript">
<!--
 
// initialize global variables
var detectableWithVB = false;
var pluginFound = false;
 
 
function goURL(daURL) {
    // if the browser can do it, use replace to preserve back button
    if(javascriptVersion1_1) {
	window.location.replace(daURL);
    } else {
	window.location = daURL;
    }
    return;
}
 
function redirectCheck(pluginFound, redirectURL, redirectIfFound) {
    // check for redirection
    if( redirectURL && ((pluginFound && redirectIfFound) || 
	(!pluginFound && !redirectIfFound)) ) {
	// go away
	goURL(redirectURL);
	return pluginFound;
    } else {
	// stay here and return result of plugin detection
	return pluginFound;
    }	
}
 
function canDetectPlugins() {
    if( detectableWithVB || (navigator.plugins && navigator.plugins.length > 0) ) {
	return true;
    } else {
	return false;
    }
}
 
function detectFlash(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('Shockwave','Flash'); 
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	pluginFound = detectActiveXControl('ShockwaveFlash.ShockwaveFlash.1');
    }
    // check for redirection
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}
 
function detectDirector(redirectURL, redirectIfFound) { 
    pluginFound = detectPlugin('Shockwave','Director'); 
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	pluginFound = detectActiveXControl('SWCtl.SWCtl.1');
    }
    // check for redirection
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}
 
function detectQuickTime(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('QuickTime');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	pluginFound = detectQuickTimeActiveXControl();
    }
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}
 
function detectReal(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('RealPlayer');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	pluginFound = (detectActiveXControl('rmocx.RealPlayer G2 Control') ||
		       detectActiveXControl('RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)') ||
		       detectActiveXControl('RealVideo.RealVideo(tm) ActiveX Control (32-bit)'));
    }	
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}
 
function detectWindowsMedia(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('Windows Media');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
		pluginFound = detectActiveXControl('MediaPlayer.MediaPlayer.1');
    }
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}
 
function detectPlugin() {
    // allow for multiple checks in a single pass
    var daPlugins = detectPlugin.arguments;
    // consider pluginFound to be false until proven true
    var pluginFound = false;
    // if plugins array is there and not fake
    if (navigator.plugins && navigator.plugins.length > 0) {
	var pluginsArrayLength = navigator.plugins.length;
	// for each plugin...
	for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
	    // loop through all desired names and check each against the current plugin name
	    var numFound = 0;
	    for(namesCounter=0; namesCounter < daPlugins.length; namesCounter++) {
		// if desired plugin name is found in either plugin name or description
			if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) || 
				(navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
				// this name was found
				numFound++;
			}   
	    }
	    // now that we have checked all the required names against this one plugin,
	    // if the number we found matches the total number provided then we were successful
	    if(numFound == daPlugins.length) {
		pluginFound = true;
		// if we've found the plugin, we can stop looking through at the rest of the plugins
		break;
	    }
	}
    }
    return pluginFound;
} // detectPlugin
 
 
// Here we write out the VBScript block for MSIE Windows
if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
    document.writeln('<script language="VBscript">');
 
    document.writeln('\'do a one-time test for a version of VBScript that can handle this code');
    document.writeln('detectableWithVB = False');
    document.writeln('If ScriptEngineMajorVersion >= 2 then');
    document.writeln('  detectableWithVB = True');
    document.writeln('End If');
 
    document.writeln('\'this next function will detect most plugins');
    document.writeln('Function detectActiveXControl(activeXControlName)');
    document.writeln('  on error resume next');
    document.writeln('  detectActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
    document.writeln('  End If');
    document.writeln('End Function');
 
    document.writeln('\'and the following function handles QuickTime');
    document.writeln('Function detectQuickTimeActiveXControl()');
    document.writeln('  on error resume next');
    document.writeln('  detectQuickTimeActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('    detectQuickTimeActiveXControl = False');
    document.writeln('    hasQuickTimeChecker = false');
    document.writeln('    Set hasQuickTimeChecker = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")');
    document.writeln('    If IsObject(hasQuickTimeChecker) Then');
    document.writeln('      If hasQuickTimeChecker.IsQuickTimeAvailable(0) Then ');
    document.writeln('        detectQuickTimeActiveXControl = True');
    document.writeln('      End If');
    document.writeln('    End If');
    document.writeln('  End If');
    document.writeln('End Function');
 
    document.writeln('</scr' + 'ipt>');
	//1
}
//3
// -->
</script>
 
</head>
 
<body>
 
<script language="JavaScript">
//2
document.write('<br><b>Can Detect Plugins:</b> ' + canDetectPlugins() + '<br><br>');
 
if(canDetectPlugins()) {
    document.write('<b>Supports Shockwave for Director:</b> ' + detectDirector() + '<br>' + 
		   '<b>Supports Shockwave Flash:</b> ' + detectFlash() + '<br>' + 
		   '<b>Supports QuickTime:</b> ' + detectQuickTime() + '<br>' +
		   '<b>Supports RealPlayer:</b> ' + detectReal() + '<br>' +
		   '<b>Supports Windows Media Player:</b> ' + detectWindowsMedia());
}
</script>
 
 
<noscript>
Your browser doesn't support JavaScript, so we can't check for plugins.
</noscript>
 
 
</body>
</html>

Open in new window

0
 
Netlink2Author Commented:
0
 
Netlink2Author Commented:
Umm, yeah, I was running the code from my C drive and the sandbox wasn't letting it through. Running from the web server was fine.

So, last question then (which is actually the first question again), how to make the same option as in the information bar in ie, but by clicking on the object ?

I'm not trying to get around the security, that can stay in, what I want is another option to select it.
0
 
Netlink2Author Commented:
Anyway, that seems to do the job for what I want. A trick is that the details for the add-on in internet explorer are stored in the registry when using the activex call.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 10
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now