Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to embed grafana inside my angularjs app. I can do it easily with a simple iframe but my app uses jwt for authentication and I can't find a way to set a header for an iframe. I've confirmed that it works perfectly fine when I turn authentication off with the basic iframe but I need it enabled to use in production.

I've also tried using $http to get the grafana html(this way I can set my jwt header) but the js doesn't seem to work using this method. I assume it's related to the bootstraping since they bootstrap manually.

//iframe
<iframe id="grafana" layout-fill flex></iframe>

//controller
  $http.get('/grafana/dashboard').then(function(response) {
      var iframeDocument = document.getElementById('grafana').contentWindow.document
      iframeDocument.open('text/html', 'replace')
      iframeDocument.write(response.data)
      iframeDocument.close()
  })

Is there other way I can set a header on an iframe? I also tried just using grafana's html as a template but as I said before their bootstrapping seems to not work within another app.

share|improve this question
    
It's not possible to set a header on an iframe. An iframe is retrieved only via GET: i.e. with a URL and a query string –  New Dev Dec 16 '14 at 21:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.