I installed Magic Mirror for the first time today and was looking for a way to show a webpage. I couldn’t really find anything and having installed a few modules and being a web developer I thought I’d give it a crack.
I’ve used another simple module as reference and after double checking with the documentation it seems like everything should be correct. However the container for the module is created, but there’s no content. Maybe there’s some restriction that I’m not aware of?
My file structure is:
/Modules
/MMM-WebView
- MMM-Webview.js
/css
- MMM-WebView.css
MMM-WebView.js:
Module.register("MMM-WebView", {
defaults: {
url: "https://www.duckduckgo.com"
},
start: function() {
var self = this;
},
getStyles: function() {
return ["modules/MMM-WebView/css/MMM-WebView.css"];
},
getDom: function() {
var wrapper = document.createElement("div");
wrapper.classList.add("wv-wrapper");
var iframe = document.createElement("iframe");
iframe.setAttribute("src", url);
iframe.innerHTML = " ";
wrapper.appendChild(iframe);
return wrapper;
},
});
And in my config:
{
disabled: false,
module: 'MMM-WebView',
position: "middle_center",
config: {
url: "https://open.spotify.com"
}
},
Is there something I’m missing?