許多網頁瀏覽器支援「InPrivate」瀏覽的概念,使用者的瀏覽紀錄不會被儲存。
為了確保 Recall 不會在這種模式下儲存使用者的瀏覽紀錄,你的應用程式可以使用這個 SetInputScope 函式,並將輸入範圍設為 IS_PASSWORD。
這很重要
你的應用程式還必須先註冊一個 http 或 https 協定處理程式,才能在 SetInputScope 中支援本文描述的行為。
[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);
}
你的應用程式應該在使用者處於「私人」瀏覽模式時暫停提供活動。