Partager via


Recall conseils pour les développeurs de navigateurs web

De nombreux navigateurs web prennent en charge un concept de navigation « InPrivate », où l’historique de l’utilisateur n’est pas enregistré.

Pour vous assurer que Recall n’enregistre pas l’historique de navigation de votre utilisateur dans des modes comme celui-ci, votre application peut utiliser la fonction SetInputScope, en définissant l’étendue d’entrée à IS_PASSWORD.

Important

Votre application doit également avoir un gestionnaire de protocole http ou inscrire un gestionnaire de protocole https avant que SetInputScope ne prenne en charge le comportement décrit dans cet article.

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

Votre application doit suspendre la fourniture d’activités utilisateur pendant que l’utilisateur est en mode de navigation « privé ».