Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # MMM-WebView: A WebView module for MagicMirror²
  2. This is a module for the [MagicMirror²](https://github.com/MichMich/MagicMirror/).
  3. MMM-WebView allows you to add a webview which can display any url.
  4. This module uses the [Electron's \<webview\> tag](https://www.electronjs.org/docs/api/webview-tag) instead of `<iframe>` to embed pages.
  5. It makes possible to display pages that cannot be displayed in a `<iframe>`.
  6. ## Installation
  7. 1. Clone this repository in your `modules` folder:
  8. ```bash
  9. cd ~/MagicMirror/modules
  10. git clone https://github.com/Iketaki/MMM-WebView.git
  11. ```
  12. 2. Add the following configuration block to the modules array in the `config/config.js` file:
  13. ```js
  14. let config = {
  15. modules: [
  16. {
  17. module: 'MMM-WebView',
  18. position: 'top_center',
  19. config: {
  20. url: 'https://www.google.com/',
  21. width: '640px',
  22. height: '480px',
  23. },
  24. },
  25. ],
  26. };
  27. ```
  28. 3. Finally, add the following configuration block to `config/config.js` file. This is required to run this module correctly.
  29. ```js
  30. let config = {
  31. electronOptions: {
  32. webPreferences: {
  33. webviewTag: true,
  34. },
  35. },
  36. };
  37. ```
  38. ## Update
  39. 1. Get the latest version using the command `git pull`:
  40. ```bash
  41. cd ~/MagicMirror/modules/MMM-WebView
  42. git pull
  43. ```
  44. ## Configuration options
  45. | Option | Description |
  46. | --------------------- | -------------------------------------------------------------------------------------------------------------------------- |
  47. | `url`<br> | [Optional] the URL in the WebView<br>Default: `https://www.google.com/` |
  48. | `width` | [Optional] the Width of the WebView (the value of CSS property `width`)<br>Default: `640px` |
  49. | `height` | [Optional] the Height of the WebView (the value of CSS property `height`)<br>Default: `480px` |
  50. | `autoRefresh` | [Optional] Set to true to allow an auto-refresh of the WebView<br>Default: `false` |
  51. | `autoRefreshInterval` | [Optional] the interval of auto-refresh for the WebView, in milliseconds If autoRefresh: true<br>Default: `10 * 60 * 1000` |
  52. | `loadedJS` | [Optional] the JavaScript code string to be executed after page load<br>Default: `undefined` |
  53. ## Motivation
  54. When considering about embedding websites to MagicMirror, some websites cannot be embedded using iframe.
  55. There are several reasons, one of that is HTTP response header `X-Frame-Options: DENY` by the websites makes iframe disable. This is needed for the internet security.
  56. For MagicMirror usage, using WebView instead of iframe may resolve the problem.