Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mailto protocol

Status
Not open for further replies.

Muddmuse

Programmer
Jul 31, 2001
85
US
I have an asp page with a list of links. Each link opens a new window which points to the same page, lets call it process.asp, and passes its destination URL in the querystring. process.asp logs some info then redirects to the URL in the querystring. The problem is that some links can be email addresses. If the protocol is mailto how can I close the new browser window after the default mail program is launched?
 
Can you post the code that writes the links? I would just remove the "Target='_blank'" statement (if that's how you're doing it.

Conversly, you could add "Target='_self" for the mailto: links

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
The issue is that process.asp has nothing to view, it calls a COM component, does some work then redirects. Whether the redirect happens in the parent window or the new window doesn't matter. Either way the result is a blank page behind the mail program launch.

Let me try to simplify - a link is clicked and a web page is loaded which processes some data (nothing is written to this browser window) then redirects to a URL that was passed as a parameter in the querystring. If this URL is a mailto: link, when the redirection happens the default mail program is launched. Since the prior page had nothing to display a blank page is left behind the mail program. In this case I want to close (or reload/redirect) that blank browser window.

Hope that clarifies.
 
Are you able to modify the URL that is passed in the queryString? If so, create a page like "mailRedirect.asp" and send the URL in th queryString as "http:\\ (you will have to use server.urlEncode to write this string).

mailRedirect.asp
Code:
<script>
  document.location="mailto:<%=request("mailto")%>"
  self.close()
</script>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
Have you tried an if statement?

myURL = request("URL")

if InStr(myURL,"mailto") then
do this
else
do this
end if

Wow JT that almost looked like you knew what you were doing!
 
mwolf00 - that's it, don't know why I didn't think of that. Thanks very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top