Freigeben über


Recall Leitfaden für Entwickler von Webbrowsern

Viele Webbrowser unterstützen ein Konzept des "InPrivate"-Browsens, bei dem der Benutzerverlauf nicht gespeichert wird.

Um sicherzustellen, dass Recall den Browserverlauf des Benutzers nicht speichert, während er in Modi wie diesem verwendet wird, kann Ihre App die SetInputScope-Funktion verwenden und den Eingabebereich auf IS_PASSWORD festlegen.

Von Bedeutung

Ihre App muss auch einen http oder https Protokollhandler registriert haben, bevor SetInputScope das in diesem Artikel beschriebene Verhalten unterstützt.

[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);
}

Ihre App sollte die Bereitstellung von Benutzeraktivitäten anhalten, während sich der Benutzer im "privaten" Browsermodus befindet.