File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 106106        cursorBlink : false 
107107      } ) ; 
108108      term . open ( document . getElementById ( "term" ) ) ; 
109+       show_https_warning ( ) ; 
109110    } ; 
110111    window . addEventListener ( 'resize' ,  function ( )  { 
111112        var  size  =  calculate_size ( self ) ; 
112113        term . resize ( size [ 0 ] ,  size [ 1 ] ) ; 
113114    } ) ; 
114115} ) . call ( this ) ; 
115116
117+ function  show_https_warning ( )  { 
118+     if  ( window . location . protocol  ==  'https:' )  { 
119+         var  warningDiv  =  document . createElement ( 'div' ) ; 
120+         warningDiv . style . cssText  =  'background:#f99;padding:5px;margin-bottom:10px;line-height:1.5em;text-align:center' ; 
121+         warningDiv . innerHTML  =  [ 
122+             'At this time, the WebREPL client cannot be accessed over HTTPS connections.' , 
123+             'Use a HTTP connection, eg. <a href="http://micropython.org/webrepl/">http://micropython.org/webrepl/</a>.' , 
124+             'Alternatively, download the files from <a href="https://github.com/micropython/webrepl">GitHub</a> and run them locally.' 
125+         ] . join ( '<br>' ) ; 
126+         document . body . insertBefore ( warningDiv ,  document . body . childNodes [ 0 ] ) ; 
127+         term . resize ( term . cols ,  term . rows  -  7 ) ; 
128+     } 
129+ } 
130+ 
116131function  button_click ( )  { 
117132    if  ( connected )  { 
118133        ws . close ( ) ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments