Comment réussir à visualiser un Webview directement en double cliquant sur le fichier .html sans avoir à fermer tous les navigateurs internet ?

1 次查看(过去 30 天)
Lorsque je souhaite visualiser un Webview.html, je reçois systématiquement le message "Unsupported Browser". Pour visualiser le Webview, je dois fermer tous les navigateurs internet (je perds toutes mes recherches en cours) et ensuite je dois ouvrir un navigateur spécifique (Chrome ou Edge) avec l'indicateur --allow-file-access-from-files. Ce n'est pas vraiment acceptable pour les utilisateurs.
Je souhaiterais pourvoir ouvrir directement le Webview à partir du fichier HTML Webview.html sans avoir à fermer toutes les pages internet.
Quelles solutions seraient possible ?

回答(1 个)

Swastik Sarkar
Swastik Sarkar 2024-6-18
Hello @Brice,
Google Chrome implements restrictions on accessing local files via "file://” URLs as a part of its security framework. This precaution is in place to safeguard your computer against potentially harmful webpages that may attempt to access files stored on your system.
To navigate around this limitation, I suggest considering one of the following workarounds, depending on your specific needs and preferences:
1. MATLAB Web Browser: MATLAB provides a way to view HTML files without leaving your editor, you can use the following command to open “Webview.html” inside it.
rptview Webview.html
2. Configuring Google Chrome for Local File Access: If your preference is to use Google Chrome for viewing the HTML file, you can create a special shortcut that launches Google Chrome with permissions to access local files. This involves modifying the shortcut to include the --allow-file-access-from-files flag. By using this modified shortcut to open Chrome, you'll be able to view your local HTML files without encountering the security restriction.
You can find more about opening web views with MATLAB by following this site:
I hope this proves helpful to view your local HTML files.

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!