I want to access methods and properties on an Activex DLL that I have created in VB6
Just some back ground...
The VB6 DLL has the project name called PDFViewer and I have a single class clsPDFViewer.
In the class there are methods and properties that I wish to use.
I am using javascript with IE9.
Basically in javascript I have made a reference to the object
Attempted two ways
var PDFViewer = new ActiveXObject("PDFViewer");
var PDFViewer = document.getElementById("PDFViewer");
An error keeps occuring saying that it cannot create ActiveX
Even if I get past this error..
When i try something like this
alert(PDFViewer.Page);
then the other error is that the properties or methods do not exist
can someone please help
I am new to javascript.. please be patient
Its frustrating when I try one way is doesn't work for one reason
and then when I try another way is doesn't work for someother reason
grrrrrr...
This is due to security restrictions in IE.
The minimum dependency is that the DLL is registered on the client. (The VB6 IDE will do this if compiling on the same machine as testing, otherwise use the Rgsvr32 command to install the DLL on the client.)
Then you can either add the URL/domain hosting your page attempting to use the DLL to IE's "Trusted Sites" zone and/or you can enable ActiveX scripting for other internet zones.
(Although the latter will leave your browser in an unsafe state and constantly annoy you with messages about such!)
Related
I’m developing a cross-platform GUI app for Mac and Windows using wx.html2.WebView, using the latest wxPython 4.1.1. (Hint: The problem started appearing in 4.1. Earlier wxPython versions, as well as the wxPython 4.1.1 for Mac, don’t have that problem, but I’m trying to migrate to the latest wxPython for various benefits it has)
The Windows app throws an error message Error: OLE Automation error in eval: Unknown name or named argument. when executing some JavaScript on WebView.RunScript().
I honestly don’t know where to start debugging. I can’t find out what JavaScript code caused the problem since the code isn’t displayed anywhere. I tried throwing in a confirmation dialog before each RunScript() call, but the execution doesn’t wait, and instead, the dialogs pile up over each other.
As the JavaScript code gets generated by the app on runtime, I did route all JavaScript code into a file and syntax-checked it externally, without errors.
The only result that shows up in Google search for that error message is this page: https://trac.wxwidgets.org/ticket/17893?cversion=2&cnum_hist=10 and the discussion hints at a custom protocol being used, which I’m not using, so it seems irrelevant.
Any ideas?
Don't know the reason behind, but I have solved the same error by adding an <script></script> element into the page contents. That is, for instance, replacing:
self.browser = wx.html2.WebView.New(self)
self.browser.SetPage('<p>Hello World!</p>')
with this:
self.browser = wx.html2.WebView.New(self)
self.browser.SetPage('<p>Hello World!</p><script></script>')
I Got this code to create a file using JavaScript.
function WriteToFile()
{
var txt = new ActiveXObject("Scripting.FileSystemObject");
var s = txt.CreateTextFile("11.txt", true);
s.WriteLine('Hello');
s.Close();
}
WriteToFile();
it is working fine with IE but not Working in Chrome and Firefox.
usually the error is ReferenceError: ActiveXObject is not defined
is there any alternate to create file in javascript, instead of ActiveXobject(Scripting.FileSystemObject") ?
This isn't possible. At least not in pure JavaScript anyway, ActiveX objects are part of the Windows/IE thing and are NOT in the ES6 spec (http://www.ecma-international.org/ecma-262/6.0/index.html), which is why they're not supported in Chrome or Firefox.
If you wish to write JavaScript programs that can create files on the users local file system you're going to need to write a client side app, such as a chrome app (https://developer.chrome.com/apps/api_index) or write your program using Electron shell(http://electron.atom.io/).
However, if what you want is a cross browser solution to create files at specific locations on a user file system, it's just not really natively possible.
Sure browser plugins exist, but you'd need every user to install the plugin, so that's not exactly practical. For security reasons websites aren't allowed to read the users hard drive, and this is a good thing!
Our clients use RDP sessions created by clicking a button on our site which uses the old MSRDP.cab file called in a webpage. We also utilize Virtual channels using a custom dll. Both our dll and the MSRDP.ocx are loaded through the object tag and cab files using VBScript.
As you might know, the orginal RDP connection script was written in VBScript. Apparently the ActiveX control will only work if called using VBScript. That has been working for over a decade. However the newer IE browsers and virtually all of the other browsers do not support VBScript.
I realize that I can call the new RDP program mstsc.exe from Javascript for a straight connection. However, we also pass information to the old ocx like the plugin parameters in Advancedsettings which include our dll that uses virtual channels. In addition, we pass the domain and username.
Maybe I'm searching in all the wrong places but I'm turning up no answers in trying to find how to run this ocx in javascript or another solution that would work. I'm thinking there has to be a replacement out there that I'm overlooking.
We are able to force our clients to use IE so we are currently having our clients with IE versions over 10 to use compatibility mode. However I'm sure at some point this may no longer work.
Has anyone out there had a similar problem that you have found a solution for? Any ideas or suggestions would be appreciated. Thanks!
You mentioned it yourself that in the future, your ActiveX may no longer work and supported so I strongly believe that you should invest your time in re-writing your app using a more modern approach instead.
Here's a link to a solution where it is using Jquery and ASP.NET to open an RDP connection:
Open RDP Connection window using jquery - client side
I am very new to writing plugins for firefox. I am writing a plugin to intercept a URL protocol (I got it here: http://www.nexgenmedia.net/docs/protocol/) inside the plugin and then call some user loaded Jscript functions to pass data.
My question is, How can i call a user script or a greasemonkey script from within a firefox plugin when the plugin is running.
This is generally a very bad idea to run arbitrary code from an extension. The extension code is executed in privileged mode with access to XPCOM (and thus the whole system).
If you really DO want to execute external JS, the best way is Components.utils.Sandbox I suppose. Other options are nsISubscriptLoader or Components.utils.import.
Also, afaik such extensions won't pass security check at Mozilla Addons and won't be accepted there as a result.
How to create a file or list the files in the folder in java script in IE7 and IE8.In general to access the file system in OS , java script uses ActiveXObject. But I need to access the file system not by ActiveXObject but by any other ways.
If I use ActiveXObject for access means,whenever access going to be happen each time a pop-up will appear that asks the user whether to allow or not ActiveXobject.It is little difficult one to client when dy faces this pop-up each time.
Is thr any Java script API exist to access the file system without use of ActiveXObject or any technique exist to do these things....?
I have to implement file system access applicaion in IE7 and IE8
If any one know kindly share ur knowledge.
Thanks in advance....
There are no ways in IE7/IE8 without browser plug-ins to access the local computer's file system because doing so is a major security risk and those browsers don't support any of the more modern ways of handling files.
You might get better ideas if you explain what actual problem you're really trying to solve rather than something as generic as your current question.
If this is an enterprise environment, you may be able to prewire some ActiveX settings in the enterprise browsers to allow your ActiveX plug-in to run without prompting.
Silverlight can have evaluated trust in browser applications in version 5
for First time it will ask user ( I've not tested it yet )
Notice that users must have installed Silverlight before then you can develop your own app by C#