Controlling Internet Explorer from Java

Discussion in 'Java' started by Paul Battersby, Jun 25, 2005.

  1. Can anyone point me in the direction of information on how to control
    Internet Explorer from Java?

    From Java, I want to tell Internet Explorer to load a page from a given Url
    (this I can already do) and then have my Java Program read the HTML that is
    being displayed by Internet Explorer.

    Is there some DDE interface or some other way I can issue commands and get
    results back from
    Internet Explorer?

    Paul Battersby, Jun 25, 2005
    1. Advertisements

  2. Javascript - LiveConnect - Applet - Socket.

    JS communicates via LiveConnect with the (signed) Applet,
    which then communicates with the application via socket.

    ( This route has a large learning curve. )
    Andrew Thompson, Jun 26, 2005
    1. Advertisements

  3. As an aside. That is a bit tricky - if the end user
    browses the net using Safari..
    Andrew Thompson, Jun 26, 2005
  4. Paul Battersby

    Roedy Green Guest

    Perhaps what would be much easier is to get IE out the picture, and
    just pretend to be a browser yourself and send off a CGI get,
    retrieving the HTML. Then extract what you want from it using a

    If you actually want to see the bits that IE renders, look at the
    Robots class. (sp?) to do a screen snapshot.

    Bush crime family lost/embezzled $3 trillion from Pentagon.
    Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.

    Canadian Mind Products, Roedy Green.
    See photos of Bush's war crimes
    Roedy Green, Jun 26, 2005
  5. The problem I'm having is that I want to automatically download some HTML
    from a web site but the remote server seems to deny my request when it comes
    from a Java program but allows me to see the data when I access the web site
    with Internet Explorer. My program works fine with other web sites, just not
    this one in particular.

    Any ideas?
    Paul Battersby, Jun 26, 2005
  6. Paul Battersby

    Roland Guest

    Probably that website checks the "User-Agent" header of the HTTP request.
    You could try to set the property "http.agent" to a value that matches
    Internet Explorer or another well known browser. Java uses the value of
    this property when it sends a HTTP request (i.e. probably when using a
    HTTPURLConnection). See

    You can specify the value of "http.agent" either at the commandline, like

    java "-Dhttp.agent=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"

    or in your program:

    // IE6/W2K
    "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");

    // Moz 1.7.8/W2K
    "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8)


    Roland de Ruiter
    ` ___ ___
    `/__/ w_/ /__/
    / \ /_/ / \
    Roland, Jun 26, 2005
  7. Paul Battersby

    Wibble Guest

    The site may have activeX controls that java will never understand.
    Jacob is a Java/Com interface that will let you control explorer. It
    should do what you want.
    Wibble, Jun 27, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.