0

I have a popup that is made with JavaScript, but the popup always goes behind the IE window - how can I make it show up always on front and to be focused?

This is my JavaScript code:

 function FindFilePath() {
        var sRet;
        var IE = new ActiveXObject("InternetExplorer.Application");
        IE.visible = false;
        IE.Navigate("about:blank");
        while (IE.busy) { }
        IE.document.focus();
        IE.document.write('<HTML><BODY><INPUT ID="Fil" Type="file"></BODY></HTML>');
        //IE.document.all.Fil.focus();
        IE.document.all.Fil.click();

        var sRet = IE.document.all.Fil.value;
        IE.quit();
        IE = null;
        document.getElementById("<%=TextBox1.ClientID %>").value = sRet; }
ADyson
  • 57,178
  • 14
  • 51
  • 63
Argjent
  • 97
  • 8
  • I think how popups appear is largely down to the user's choice in the browser. P.S. Any particular reason you're using ActiveX just to open a simple HTML popup? – ADyson Oct 01 '18 at 09:21
  • @ADyson No there is no reason I just need the path of the file to be in TextBox1 and it must be javascript because it is compiled in IE5. This is the only method I know how to do it :( – Argjent Oct 01 '18 at 10:27
  • IE **5**! Who is still using it and why?? It was last included with Windows 2000.... If it really must work using this historical relic then yes ActiveX might actually be your only option - I'm not sure, I'm too young (just) to have worked on that browser, but did you try `window.open()` instead? Also check the browser's popup settings (if it has any) as I mentioned. – ADyson Oct 01 '18 at 10:40
  • @ADyson Now I cant use windows.open() because I need to upload a file and with windows.open() I couldn't do that :( and I am working on an old app that is running on IE5 and I have no idea why but all I know I can not update it because its against the rules or something like that and I am stuck :( – Argjent Oct 01 '18 at 11:11
  • 1
    files are uploaded by submitting a form containing a `type="file"` input. That's really nothing to do with how you initialise a popup. – ADyson Oct 01 '18 at 14:30

0 Answers0