Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 936635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:20:49+00:00 2026-05-15T21:20:49+00:00

I have desktop application with WebBrowser control and try to inject JavaScript into loaded

  • 0

I have desktop application with WebBrowser control and try to inject JavaScript into loaded page.

For this I added two script elements:

private static void AddJQueryElement(HtmlElement head)
{
    HtmlElement scriptEl = head.Document.CreateElement("script");
    IHTMLScriptElement jQueryElement = (IHTMLScriptElement)scriptEl.DomElement;
    jQueryElement.src = @"http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js";

    head.AppendChild(scriptEl);           
}

private static void AddScriptElement(HtmlElement head)
{
    HtmlElement scriptEl = head.Document.CreateElement("script");
    IHTMLScriptElement myScriptElement = (IHTMLScriptElement)scriptEl.DomElement;
    myScriptElement.src = @"file:///c:\JScript.js";
    head.AppendChild(scriptEl);
}

how you can see first is reference to jQuery because I use it in my script. When I try to invoke function from my script using _webBrowser.Document.InvokeScript WebBrowser throws
Script Error :”Object expected”. and points to the line where i try to use jQuery (var tags = $("Body").find("*");).

How can I prevent this error?

Another interesting thing: if I add something like alert("hello"); to start of my function all works fine.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:20:50+00:00Added an answer on May 15, 2026 at 9:20 pm

    Haven’t got correct answer, but have solved the problem by using local copy of jquery.min.js.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 495k
  • Answers 495k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer strpos never returns true. You will need to test for… May 16, 2026 at 11:14 am
  • Editorial Team
    Editorial Team added an answer When you recurse through the XML nodes, you're not returning… May 16, 2026 at 11:14 am
  • Editorial Team
    Editorial Team added an answer Tam, Flash player 10.1 has facility to access Microphone and… May 16, 2026 at 11:14 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have used ProgressBar Control in my c# desktop application.I have used it in
I have two different options using database in a desktop application. I prefer the
I have a major problem. We have a asp.net application that has this report
I have a Facebook desktop application and am using the Graph API . I
For one of my Linux applications, I have the application binary, a launcher.sh script
I'm building a desktop application right now that presents its human-readable output as XHTML
More exactly, the web browser control. In a WM6 dialog based MFC project. This
I'm working on the design of a remote control application. From my iPhone or
I'm developing an application that tracks the user's current position and stores it into
I have 1 computer with 1 network card installed. The network card has 10

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.