Internet explorer add on and the website - c#

Is the website able to determine if a particular IE add on has been installed or not?
How do you have the web page detect the IE add on?

In general, no; however it depends on what the add-on does. If it modifies the web page in some way (e.g. removing ads) then it should be possible to use Javascript to detect if the current page has been modified.

If the addon is available via Javascript/ActiveX interface, its absense may be checked by catching an exception on calling some (missing) addon's function.
This way, checking for few common addons leads to nice browser's fingerprinting method.
Refer to: http://www.informatica64.com/Wbfingerprinting/

No doubt you can detect most through JavaScript; it'd be addon-specific.

In IE just expose an Active X control from your add-on, and then instantiate it using new ActiveXControl() inside a Javascript try {} block. If it succeeds, your extension is installed. If it fails, probably not. You can even expose a .version() method to get the version of the control.

Related

how to get a program to fill out a web page

I am trying to make an application that will fill in the info i type into the actual web page so I can register at websites very very easy whenever I need them. However I'm not sure how I would go about this. I know I would either have to use a WebBrowser or an Html request, but I am not sure what the basic syntax for it is. I could really use the help!
EDIT: I am trying to use Document.GetElementByID in order to do this. I don't want to use plugins to do this. I want to go a program.
Look into Browser Helper Objects and how to implement them in .NET. BHO-s can interact with the page loaded into an IE browser.

Calling ActionScript (Flash) method via mshtml from C#

I use the WebBrowser component from WPF. I load there a page from Internet and I access the Document property to call my scripts. Unfortunately calling scripts don't work as I need. When I am calling JavaScript methods which exist in JavaScript so it works great but when I need access some methods which are available through Flash so I have problems.
document.parentWindow.execScript("document.getElementById('swfObject').methodFromActionScript();", "JavaScript");
I get an exception in the browser Object doesn't support this property or method. In C# I get Exception from HRESULT: 0x80020101
But when I try launch this code in a regular browser as IE or Chrome by passing it into URL so the code is executed and I see results.
Maybe some trustmode issues or what else could deny access to Flash properties and methods?
BTW: The var allowScriptAccess is set to always.
Thank you for help.
Ok, I've found an issue. Before this execScript. I was doing some modification of DOM and moving elements and apparently this has broken DOM so I couldn't call swfObject because during moving it was somehow modified and lost its properties and methods which were exported via ActionScript.

How to access the elements within an <IFRAME>?

How to access the elements within an in WebBrowser in C#.NET?
try this
webBrowser1.Document.GetElementById("idName").SetAttribute("value") = "ddddd" ;
var stuff=webBrowser1.Document.GetElementById("idName").GetAttribute("attribute");
it works for me when I need to get/set control data and get any html element value
Generally, you can't. C# and .NET are typically used in frameworks like ASP.NET to produce the content that is consumed by the browser. This happens on the server-side.
If .NET is installed on the client, then you can host a Windows Forms control in an HTML document in Internet Explorer but this is very, very non-standard, and I'd advise heavily against doing so.
As far as I understand you can access the controls inside the webbroswer control using the following code
WebBrowser1.Document.GetElementById("controlId").
Is this what you are looking for?
Additionally this discussion in daniweb might be of some interest to you.

Invoke default browser from C#?

How to invoke the default browser with an URL from C#?
System.Diagnostics.Process.Start("http://www.google.com");
More details here -
http://msdn.microsoft.com/en-us/library/aa326951.aspx
System.Diagnostics.Process.Start("http://mysite.com");
I used System.Diagnostics.Process.Start in the past, but if Firefox or another browser is set as the default this method always throws a terrible exception to users. At last, I come across System.Windows.Forms.Help.ShowHelp
Help.ShowHelp(null, "http://www.google.com");
Please notice that Help is a class only available for WinForms, while Process can be used for other cases (WebForms, WPF and so on).

Getting the back/fwd history of the WebBrowser Control

In C# WinForms, what's the proper way to get the backward/forward history stacks for the System.Windows.Forms.WebBrowser?
Check out http://www.bsalsa.com/downloads.html. This is a series of Delphi components (free source code, you can see an example of this here: http://staruml.cvs.sourceforge.net/staruml/staruml/staruml/components/plastic-components/src/embeddedwb.pas?revision=1.1&view=markup - it's the starUML projects code) and they have, among other things, a way to get at the history, favorites, etc using the IE MSHTML interfaces. It's written in Object Pascal but it shouldn't be too hard to figure out what's going on. If you download the "Embedded Web Browser Components Package" take a look at the stuff in EmbeddedWB_D2005\Source - there's all sorts of goodies there.
It doesn't look like it's possible.
My suggestion would be to catch the Navigated event and maintain your own list. A possible problem with that is when the user clicks back in the browser, you don't know to unwind the stack.

Categories