폼에 WebBrowser 컨트롤이 있습니다.WebBrowser를 표시하지 않습니다. mailto
사용자가 링크 (mailto로 href)를 클릭하면 버튼이 클릭 된 웹 사이트에 등록되지만 새 창 (Outlook이나 다른 웹 사이트는 열지 않음)이 열리지 않기를 바랍니다.
는이 코드를 발견,하지만 작동하지 않습니다 그것을 할 수있는 간단한 방법이 있는지
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
TextReader tr = File.OpenText(webBrowser1.Url.ToString());
string htmlFile = tr.ReadToEnd();
tr.Close();
tr.Dispose();
if (htmlFile.Contains("mailto:"))
{
htmlFile = htmlFile.Replace("mailto:", @"mail");
//Recreate new file with fixed html
File.Delete(e.Url.LocalPath);
TextWriter tw = File.CreateText(e.Url.LocalPath);
tw.Write(htmlFile);
tw.Flush();
tw.Close();
tw.Dispose();
Refresh();
}
}
는 대답은,이 코드를 수정하는 방법 일 필요 없다? 좋아질거야.
이 나를 위해 일을 방지 할 수 있도록 그 이벤트는 취소 할 수있다 – AlonMln