title: How to get screen resolution from JavaScript in R Shiny?
body: <p>I want to get screen resolution from JavaScript, stored in the <code>GetScreenWidth</code> variable on Shiny Server.</p>
  
  <p>I tried the reference:</p>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/32141128/receiving-data-from-js-in-server-r-shiny?lq=1">Receiving data from .js in server.R shiny</a></li>
  <li><a href="https://ryouready.wordpress.com/2013/11/20/sending-data-from-client-to-server-and-back-using-shiny/" rel="nofollow noreferrer">https://ryouready.wordpress.com/2013/11/20/sending-data-from-client-to-server-and-back-using-shiny/</a></li>
  </ol>
  
  <p>So I have:</p>
  
  <p><strong>ui.R</strong></p>
  
  <pre><code>shinyUI(
    bootstrapPage(
  
      verbatimTextOutput("results")
      ,tags$script('
          var jsWidth = screen.width;
          Shiny.onInputChange("GetScreenWidth",jsWidth);
      ')
     )
   )
  </code></pre>
  
  <p><strong>server.R</strong></p>
  
  <pre><code> shinyServer(function(input,output){
  
       output$results=renderPrint({
       input$GetScreenWidth
     })
  
   })
  </code></pre>
  
  <p>It will return <code>NULL</code> by <code>verbatimTextOutput</code>.</p>
  
  <p>How should I modify the code? Thanks!</p>