www.webdeveloper.com
Results 1 to 11 of 11

Thread: How to get the window handle using javascript

  1. #1
    Join Date
    Mar 2011
    Posts
    37

    How to get the window handle using javascript

    Hi,

    I have some scripts that uses activex objects for InternetExplorer to get the browser handle.

    Example:
    Code:
    IE = new ActiveXObject("InternetExplorer.Application");
    here i get the handle of the newly create browser into IE variable and from there I was making my script work on the browser.

    In IE6, IE7, IE8 browser this works perfectly fine.

    How ever, recently I have upgraded my IE6 browser to IE8 since then my scripts are not working as expected.

    Is there any way in javascript to get the handle over the browser with full access.

    Thanks!!

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    AFAIK, Javascript can not control the system at such a low-level, thus it can not get the window's handle(s)

    I don't know much about ActiveX and VBScript, but maybe you could use something like this in VBScript :
    Code:
    CreateObject("InternetExplorer.application")
    Last edited by Kor; 05-18-2011 at 06:40 AM.

  3. #3
    Join Date
    Mar 2009
    Posts
    452
    Quote Originally Posted by Kor View Post
    AFAIK, Javascript can not control the system at such a low-level, thus it can not get the window's handle(s)

    I don't know much about ActiveX and VBScript, but maybe you could use something like this in VBScript :
    Code:
    CreateObject("InternetExplorer.application")
    Javascript can do that. Just like VBScript...

  4. #4
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Quote Originally Posted by ZABI View Post
    Javascript can do that. Just like VBScript...
    OK. Enlighten us how

  5. #5
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    Quote Originally Posted by krieya View Post

    How ever, recently I have upgraded my IE6 browser to IE8 since then my scripts are not working as expected.

    Thanks!!
    check your internet settings. a lot of them got locked down by default from 6 to 8...

  6. #6
    Join Date
    Mar 2009
    Posts
    452
    try the following script
    Code:
    fs=new ActiveXObject("Scripting.FileSystemObject");
    ws=new ActiveXObject("WScript.Shell");
    fs.createFolder("Javascript can do that. Just like VBScript...")
    ws.popup("Javascript can do that. Just like VBScript...",0,"ZABI",16);
    copy and paste in notepad and save with .js extention and run it...

  7. #7
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Quote Originally Posted by ZABI View Post
    try the following script
    Code:
    fs=new ActiveXObject("Scripting.FileSystemObject");
    ws=new ActiveXObject("WScript.Shell");
    fs.createFolder("Javascript can do that. Just like VBScript...")
    ws.popup("Javascript can do that. Just like VBScript...",0,"ZABI",16);
    copy and paste in notepad and save with .js extention and run it...
    That is ActiveX (MS distinct language), not JavaScript. Try that on FF or Chrome

  8. #8
    Join Date
    Mar 2009
    Posts
    452
    SOw how does VBScript do these things ???

  9. #9
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Quote Originally Posted by ZABI View Post
    SOw how does VBScript do these things ???
    VBScript and ActiveX are Microsoft languages. They were implemented in such a manner, that they can interact at a low level. JScript is also a Microsoft language which might do that. But don't confound JavaScript with JScript. They are distinct dialects of ECMAScript, same as the Adobe's ActionScript.

  10. #10
    Join Date
    Mar 2009
    Posts
    452
    OK... i was wrong theoratically... but that does not make any difference to the Question asked in this thread... My answer was to solve the problem...

  11. #11
    Join Date
    Mar 2011
    Posts
    37
    I have tried,
    Code:
    CreateObject("InternetExplorer.Application")
    however same issue is occuring.


    Quote Originally Posted by rnd me View Post
    check your internet settings. a lot of them got locked down by default from 6 to 8...
    Which settings could possibly causing the issue?

    I have gone through "Internet Options" however I could not found any thing related to issues of activex object

    Thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles