많은 웹 브라우저는 사용자의 기록이 저장되지 않는 "InPrivate" 검색 개념을 지원합니다.
이와 같은 모드에서 사용자의 검색 기록이 저장되지 않도록 하려면, 앱에서 SetInputScope 함수를 사용하여 입력 범위를 IS_PASSWORD로 설정할 수 있습니다.
중요합니다
이를 위해 SetInputScope가 이 문서에 설명된 동작을 지원하기 전에 앱에 http 또는 https 프로토콜 처리기가 등록되어 있어야 합니다.
[DllImport("msctf.dll", SetLastError = true)]
private static extern int SetInputScope(IntPtr hwnd, InputScope inputScope);
private new enum InputScope : int
{
IS_DEFAULT = 0,
IS_URL = 1,
IS_FILE_FULLFILEPATH = 2,
IS_PRIVATE = 0x1f // Input is treated as private (e.g. passwords)
}
private void EnterInPrivateMode()
{
// Get your HWND. This will vary based on your UI Framework. WPF can use WindowInteropHelper, passing in your current Window.
IntPtr hwnd = new WindowInteropHelper(this).Handle;
// Then, set the input scope on the HWND to private
SetInputScope(hwnd, InputScope.IS_PRIVATE);
}
private void ExitInPrivateMode()
{
// Get your HWND. This will vary based on your UI Framework. WPF can use WindowInteropHelper, passing in your current Window.
IntPtr hwnd = new WindowInteropHelper(this).Handle;
// Then, set the input scope on the HWND to default
SetInputScope(hwnd, InputScope.IS_DEFAULT);
}
사용자가 "프라이빗" 브라우징 모드에 있는 동안 앱에서 사용자 활동 제공을 일시 중단해야 합니다.
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
Windows developer