473,847 Members | 2,464 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AxWebBrowser and JavaScript,

Hi,

I'm displaying a html page in the AxWebBrowser web control. The html
contains some JavaScript. When I run this in IE it all works fine,
however, when I run it in AxWebBrowser I get a "object expected"
scripting error when a click event is raised.

Can anyone help?
Nov 15 '05 #1
4 6083
What's in the click event?

"Chris Soulsby" <ch***********@ sysinx.com> wrote in message
news:86******** *************** ***@posting.goo gle.com...
Hi,

I'm displaying a html page in the AxWebBrowser web control. The html
contains some JavaScript. When I run this in IE it all works fine,
however, when I run it in AxWebBrowser I get a "object expected"
scripting error when a click event is raised.

Can anyone help?

Nov 15 '05 #2
Its the onclick event the <A onclick="javasc ript:Toggle(thi s)">

Then in the scripting bit:

function Toggle(node)
{
...
}

"Gordon Truslove" <Go************ *@QCL-Solutions.com> wrote in message
news:O0******** ******@TK2MSFTN GP09.phx.gbl...
What's in the click event?

"Chris Soulsby" <ch***********@ sysinx.com> wrote in message
news:86******** *************** ***@posting.goo gle.com...
Hi,

I'm displaying a html page in the AxWebBrowser web control. The html
contains some JavaScript. When I run this in IE it all works fine,
however, when I run it in AxWebBrowser I get a "object expected"
scripting error when a click event is raised.

Can anyone help?


Nov 15 '05 #3
Not totally sure what you're doing but:
try this...

instead of
el.innerHTML = this.Html;
try
el.location = "about:"+this.H tml;

you can also run javascript in the browser from a c# app by doing this..
el.location = "javascript:"+S omeScipt;

"Chris Soulsby" <ch***********@ sysinx.com> wrote in message
news:OQ******** ******@TK2MSFTN GP12.phx.gbl...
Its the onclick event the <A onclick="javasc ript:Toggle(thi s)">

Then in the scripting bit:

function Toggle(node)
{
...
}

"Gordon Truslove" <Go************ *@QCL-Solutions.com> wrote in message
news:O0******** ******@TK2MSFTN GP09.phx.gbl...
What's in the click event?

"Chris Soulsby" <ch***********@ sysinx.com> wrote in message
news:86******** *************** ***@posting.goo gle.com...
Hi,

I'm displaying a html page in the AxWebBrowser web control. The html
contains some JavaScript. When I run this in IE it all works fine,
however, when I run it in AxWebBrowser I get a "object expected"
scripting error when a click event is raised.

Can anyone help?



Nov 15 '05 #4
I've solved the problem :-)

The problem was that I was setting the html like this:

mshtml.IHTMLEle ment oIHTMLElement = null;
mshtml.IHTMLDoc ument2 oIHTMLDocument2 =
(mshtml.IHTMLDo cument2)this.Do cument;
oIHTMLElement = oIHTMLDocument2 .body;
el.innerHTML = m_strHtml;

This was not setting up the scripting and style sheet stuff. The answer was
to used the write method on the document. For example:

mshtml.IHTMLDoc ument2 oIHTMLDocument2 =
(mshtml.IHTMLDo cument2)this.Do cument;
oIHTMLDocument2 .write(strHtml) ;

Thanks for all the help.

Chris

"Chris Soulsby" <ch***********@ sysinx.com> wrote in message
news:86******** *************** ***@posting.goo gle.com...
Hi,

I'm displaying a html page in the AxWebBrowser web control. The html
contains some JavaScript. When I run this in IE it all works fine,
however, when I run it in AxWebBrowser I get a "object expected"
scripting error when a click event is raised.

Can anyone help?

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3390
by: Zürcher See | last post by:
Having the webbrowser in a windows form is possible to block a javascript allert message? Is possible to catch the modal windows popup event?
1
1548
by: Arturo j Torres | last post by:
Hi! I wrote an app to log-in and retrieve a numer of webpages. To do this I have used an AxWebBrowser, controlling the iexplorer with SendKeys (yes, i know this is anything but elegant, but i like the iexplorer doing all dirty work ;). The only problem for this, is that the control must have the focus (and therefore be visible)... Now, i'm trying to make things in a better way, but the
3
3382
by: Simon CJC | last post by:
Hello I use AxSHDocVw.AxWebBrowser in a windows application. But sometimes the url I browsed in AxSHDocVw.AxWebBrowser contains error caused by javascript. Can I prevent javascript from running in AxSHDocVw.AxWebBrowser Thanks Simon CJC
0
1140
by: Pengyu Hong | last post by:
Hi, I host an AxWebBrowser control in my application. Some web sites have Javascript that will open a new window and show results in the new window. I used the following codes to create a new form containing an AxWebBrowser control when a new window will be created: private void m_axWebBrowser_NewWindow2(object sender, AxSHDocVw.DWebBrowserEvents2_NewWindow2Event e)
3
2889
by: Ajai Kumar .R | last post by:
Hai all, I'm getting javascript errors/alert windows on AxWebBrowser. Does any body know how to disable these popups. Thanks in advance. Ajai Kumar .R
2
6414
by: | last post by:
Hi all, I would like to know if there are anyways to disable javascript, activeX and all scripting on AxWebBrowser. I have a program that include the AxWebBrowser and load internet pages, but some pages keep having javascript error and a popup was shown. I want to eliminate all the popup from javascript and other object, how can I achieve this? Thanks a lot. Windy.
12
6932
by: Don Juan | last post by:
I have had a terrible 10 days period with AxWebBrowser ActiveX Control. I can't understand why there is no goog documentation and tutorials for that monster.
2
2076
by: gkostova | last post by:
Hello, Can someone help me. I use Web Browser in my windows form to display html document using flash and javascript, the problem is that not I canot navigate trought all pages of the flash . Then I decided to use AxWebBrowser and wrote AxWebBrowser webBr = new AxWebBrowser(); form.Controls.Add(webBr); form.Activate(); webBr.Dock = DockStyle.Fill; webBr.Parent =...
2
2119
by: Michael | last post by:
Hi experts, I am using axWebBrowser in windows form to load web pages. There is a page that contains a group of buttons. (More than 10 buttons.) The source code behind each button is like below: <input type="submit" name="Submit" value="Submit" onClick="afm.__act.value=' SITE.9.20081206A__id.30.AdminsSelected.adp.actRegister';return SubmitOnlyOnce();">
0
9879
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9727
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10981
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9477
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7050
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5716
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3158
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.