dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] Close mailto tab

Hybrid View

  1. #1
    Join Date
    Sep 2013
    Posts
    3

    resolved [RESOLVED] Close mailto tab

    Hi all,

    I have run into a issue where when I have a javascript function which opens a window to a mailto tab, in firefox and chrome blank tabs appear. Outlook opens and all the information is there, but I would like the new tab to automatically close like it does in IE.

    This is my code so far:

    <script type="text/javascript">
    function open_win() {
    var dropList = document.forms[0]['ProdDropClient'];


    window.open("mailto:" + document.forms[0]['EmailBox'].value + "?subject=Key&body=Hi,%0D%0A%0D%0ARegistered Company Name: " + document.forms[0]['NameBox'].value + "%0D%0AProduct : " + dropList.options[parm.selectedIndex].text + "%0D%0AKey Generated : " + document.forms[0]['KeyBox'].value + "%0D%0A%0D%0AThanks,%0D%0AWinfreight");


    }
    </script>

    I have tried the following options,

    1. window.opener.close();
    2. setTimeout("window.close()", 5000);
    3. self.close();

    and a couple others. I created a seperate javascript function which will close a window which I then called after I had executed the open window function, but that didn't work either. I just have no idea how to fix this. Any help would be MUCH appreciated, thanks

  2. #2
    Join Date
    Sep 2013
    Posts
    3
    Ok I figured it out

    here is code:

    <script type="text/javascript">
    function close_win() {
    mail.close();
    }
    function open_win() {
    var dropList = document.forms[0]['ProdDropClient'];
    mail = window.open("mailto:" + document.forms[0]['EmailBox'].value + "?subject=Key&body=Hi,%0D%0A%0D%0ARegistered Company Name: " + document.forms[0]['NameBox'].value + "%0D%0AProduct : " + dropList.options[dropList.selectedIndex].text + "%0D%0AKey Generated : " + document.forms[0]['KeyBox'].value + "%0D%0A%0D%0AThanks,%0D%0AWinfreight");
    close_win();
    }

    </script>

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