MagicMirror² v2.12.0 is available! For more information about this release, check out this topic.

iFrame with username and password



  • im trying to change the iframe module so it can handle password protected sites but it wont work
    any tips?

    /* Magic Mirror Config Sample
     *
     * By Michael Teeuw http://michaelteeuw.nl
     * MIT Licensed.
     *
     * For more information how you can configurate this file
     * See https://github.com/MichMich/MagicMirror#configuration
     *
     */
    
    var config = 
    {
        address: "localhost", // Address to listen on, can be:
                              // - "localhost", "127.0.0.1", "::1" to listen on loopback interface
                              // - another specific IPv4/6 to listen on a specific interface
                              // - "", "0.0.0.0", "::" to listen on any interface
                              // Default, when address config is left out, is "localhost"
        port: 8080,
        ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses
                                                               // or add a specific IPv4 of 192.168.1.5 :
                                                               // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
                                                               // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
                                                               // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
        
        language: "de",
        timeFormat: 24,
        units: "metric", 
    
    modules: [
    		//MODUL
    			{
    				module: 'iFrame',
    				position: 'bottom_center',	// This can be any of the regions.
    					config: {
    								// See 'Configuration options' for more information.
    							url: ["https://www.stundenplan24.de/20070498/vplan/"],  // as many URLs you want or you can just ["ENTER IN URL"] if single URL.
    							//updateInterval: 0.5 * 60 * 1000, // rotate URLs every 30 seconds
    							width: "100%", // Optional. Default: 100%
    							height: "100px" //Optional. Default: 100px
    							}
    			},	
    			
                
    			
    			
            ]
    
    };
    if (typeof module !== "undefined") {module.exports = config;}
    
    
    
    
    /* global Module */
    
    /* Magic Mirror
     * Module: iFrame
     *
     * By Ben Williams http://desertblade.com
     * MIT Licensed.
     */
    
    Module.register("iFrame",{
    		// Default module config.
    		defaults: {
    				height:"300px",
    				width:"100%"
    		},
    
    
    	// Override dom generator. 
    	getDom: function() { 
    		var iframe = document.createElement("iframe");
            iframe.id="framer";
    		iframe.style = "border:0";
    		iframe.width = this.config.width;
    		iframe.height = this.config.height;
            
    		//iframe.src =  this.config.url;
            /*var iframeURL = this.config.url;
            var iframeID = "framer";
            var req = new XMLHttpRequest();
            req.open("POST",this.iframeURL,false, "username", "password");
            req.send();
            var iFrameWin =document.getElementbyID(this.iframeID);*/
            iFrameWin.src = "google.de";
            //this.iframeURL + "?extraParameters=true";
            
            
            
    		return iframe;
    	}
    
    });
    
    

  • Project Sponsor

    Hi Nox,
    did you find a solution for this?
    Best,
    Phillip


Log in to reply