Implementing Webbrowser control in MFC VC++ application. when there are script errors on the page it displays all the time even when I un-select "Display a notification about every script error" in Internet Explorer. This control inherits the other options like "Show Images" from IE but not script errors.
I tried to debug "OnNavigateError()" and "OnNewBrowserWindow()" events but it still does not come here. I know in C# there is a property called "ScriptErrorsSuppressed" to disable script error in webbrowser control but how to do it in VC++. please help.
Please be aware that you can never catch all errors and you should also consider displaying these annoying messages. After all, a WebBrowser control is not a browser and is used, many times, for a limited purpose (for example: I am using such for a mapping project). So you can just turn these messages off by calling:
m_Browser.put_Silent(TRUE);
You need to read the MSDN article: How to handle script errors as a WebBrowser control host and add several include files
#include <Docobj.h>
#include <Mshtml.h>
And finally define:
DEFINE_GUID(CGID_DocHostCommandHandler,0xf38bc242,0xb950,0x11d1,0x89,0x18,0x00,0xc0,0x4f,0xc2,0xc8,0x36);
MSDN provides some information on How to handle script errors as a WebBrowser control host. That information worked for me.
Related
I am trying to make a custom web browser inside an electron application. Using webview (because iframe is not loading some necessary web pages) I can load a web page.
Then trying to write something into the web pageĀ“s input by clicking on the react-simple-keyboard which causes blur event, so input loses focus.
I figured out, that this approach would not work directly, so via ipc communication I am trying to resend the key button value and then set it to the window with const {keyboard} = require("#nut-tree/nut-js"); keyboard.type(args.value);
In my input, above the webview tag, it works like a charm, but I am not able to type inside the webview.
Can anyone help me to solve this problem or does anyone know a perfect solution how to use other OSK in electron app or how to open native windows osk on input focus? Thank you in advance.
I'm not sure how you'd accomplish that with this library. But you can just use Window's default on-screen-keyboard to accomplish that. Here is a link to how enable it. windows support
You should also use a BrowserView instead of a Webview, as the Webview is not guaranteed to be present in future versions and it's API is unstable.
The BrowserView doesn't work like an HTML element though and you should read the docs here.
But anyways, just use the system's default and you should be fine.
Also, if you're interested, I'm developing a web browser with Electron (in fact, I'm currently writing this using that browser) and as far as I can say, it's written pretty simply and anyone should understand most of it, so take a look if you're in trouble. But I am no expert and you shouldn't rely on my code as a standard of any kind, really.
Well, I might have just found an answer for you.
Firstly, as I mentioned, you should use a BrowserView instead of webView for your external content, and this time it is a requirement for this method to work. I would create a BrowserWindow with the controls at the top, then place a BrowserView to act as a "browser" and create another BrowserView at the bottom and load in the keyboard html file. And then, when a key is pressed on the virtual keyboard, you should send an ipc message to the main script with the information of what key was pressed(it should be done via a preload script for the OSK BrowserView). In the main script, once you recieve the ipc message (via ipcMain.on()) you should then send an input event to the BrowserView containing your external content. That's done by calling contents.sendInputEvent(Event), so it has to be a main script. Here is a link to contents.sendInputEvent(Event), BrowserView (link) and preload script as well as ipc communication (link).
As for invoking the keyboard once you click on the input element, you could probably do it with a preload script for your "browser's" BrowserView, if you can find how you can check whether the focused element is an input element or something like that, and call an ipc message to then hide or show the keyboard. (Hiding and shwoing the keyboard could be done by calling BrowserWindow.addBrowserView(BrowserView) or BrowserWindow.removeBrowserView(BrowserView). But you would have to search the documentation yourself for those methods as I can't write anymore right now. Documentation could anwser any of your questions if you search for it there.
I am trying to spy a pop-up. But I couldn't recognize any element using any spy mode(Even I tried region mode)on the pop-up. It was throwing an error "Can't perform any spying operation". When I inspect the popup it was created using JQuery Event Handlers. Does anyone know how to solve the spying operation?
There are two reasons why this might be occurring:
Your system's OLEACC.DLL file is not properly registered - More information is available here on how to resolve this, but the solution boils down to the following:
Open a Command Prompt (CMD.EXE) with Administrator privileges
Navigate within that to the location of your OLEACC.DLL file (usually 'C:\Windows\System32' directory)
Run the following command to re-register the DLL file:
regsvr32 OLEACC.DLL
The window is created in the window hierarchy in such a way that it technically doesn't reside within the application you're attached to - Popups generated by certain web applications are not spyable using HTML mode. Instead, you'll have to create an entirely new object with new attaching logic to be able to spy this particular window. More information on this issue is available at the following resources:
Blue Prism Knowledge Base Article - 'The window spied was not found in the model' error when spying
Blue Prism Browser Automation Guide
I want to know if it's possible to launch windows applications from a website. If it is possible, how? Sort of like battlelog for battlefield, when a button is pushed it opens an application.
Edit: This is for personal use
Try this:
Make each button be a link to download a company template file for the given application. For example, the "Excel" button would download and the user should be prompted to open it with Excel.
For instance, try clicking one of the links here:
http://www.google.com/#sclient=psy&hl=en&q=template+filetype:xls
Linking to static files on the web server should be sufficient, so long as your server sends the correct MIME-Type or Content-Type.
HOPE it helps!
Take a look at this thread. it should point you in the right direction. In short you can do this in IE using ActiveX objects. But I must warn you that it is a very bad idea
While you browse in a gui's activex control shell.explorer, sometimes the page has an script error and a message appears saying there was an error and stopping the program. How can I block these messages from the activex? I know I can in IE, in the settings menu or somewhere and I did it but it doesn't apply for activex control as it runs separately from IE (if you login somewhere in IE you also have to login on the activex, for example)
Sorry I found out what I wanted. I wanted to turn off the annoying script error messages and you can do so with IEObj.silent:=1
I have a link http://xxx.yyy.net/zzz/OpacAccess?wsdl that opens in IE and shows the methods of web service correctly.
However, I have a console application where I'm trying to add a web reference but I'm not able to get it working. I right-click the project and click "Add service reference..." From here, I click "Advanced..." and from there I click "Add Web Reference...". When I enter the URL here, it shows me the methods correctly, but I'm unable to add the reference (the button is greyed-out) and the following error is shown:
There was an error downloading 'http://xxx.yyy.net/zzz/OpacAccess?wsdl'. Unable to connect to the remote server. No connection could be made because the target machine actively refused it 127.0.0.1:80.
If I use the visual studio command-line with the following command,
wsdl http://xxx.yyy.net/zzz/OpacAccess?wsdl
, I get "There was an error processing http://xxx.yyy.net/zzz/OpacAccess?wsdl", followed by the above errors.
Thanks very much in advance for any assistance you could provide.
In general, when you can access something through the browser, but not through another program you believe should work like the browser, then the problem is that the other program is not, in fact, behaving like the browser does.
The most common reason for this is proxy settings. The browser will usually have them set (perhaps automatically through Group Policy or the equivalent), and your other program will not.