Qlik Community

Ask a Question

Knowledge Base

Search or browse our knowledge base to find answers to your questions ranging from account questions to troubleshooting error messages. The content is curated and updated by our global Support team

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER

Qlik Sense Enterprise SaaS: How to embed a chart in an iFrame

Damien_Villaret
Support
Support

Qlik Sense Enterprise SaaS: How to embed a chart in an iFrame

In Qlik Cloud Services (Qlik Sense Enterprise SaaS), it is possible to get the iFrame HTML code to embed a chart in a webpage by right-clicking that chart and choosing "embed chart".
However, just placing this code on a web page is not sufficient to handle the authentication part.

The information provided in this article provides an example on how this can be achieved. Further customization is likely necessary. For assistance, join our active community in the Integrations and Extensions forum or contact our Consulting Services for an engagement. 

Environments:

  • Qlik Cloud Services April 2019 and later

 

Resolution:


In order to handle the authentication and be able to see the chart on an external web page, the parent site needs to do a redirection and let the user authenticate, below is a code example of how to do that.
 

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script type="text/javascript">
    const webIntegrationId = "g-yrbnOz9wV5-YnIqYLZMgfAxf_iKg30";
    function login() {
      function isLoggedIn() {
        return fetch("https://yourtenant.eu.qlikcloud.com/api/v1/users/me", {
          method: 'GET',
          mode: 'cors',
          credentials: 'include',
          headers: {
            'Content-Type': 'application/json',
            'qlik-web-integration-id': webIntegrationId,
          },
        }).then(response => {
          return response.status === 200;
        });
      }
      return isLoggedIn().then(loggedIn => {
        if (!loggedIn) {
          // check login
            window.location.href = "https://yourtenant.eu.qlikcloud.com/login?qlik-web-integration-id=" + webIntegrationId + "&returnto=" + location.href;          
        }
      });
    }
	login()
  </script>
</head>

<body style="height:600px;">
	<iframe
    src="https://yourtenant.eu.qlikcloud.com/single/?appid=9539b869-1c84-4e6d-9129-4c5b031ca88a&obj=WJhPv&opt=ctxmenu,currsel"
    style="border:none;width:100%;height:100%;"></iframe>
</body>
</html>


In order for the above code to work, a Web integration element must have been first created in the Qlik Cloud Services management console under Integration > Web.

The website hosting the page must have been added to the list of allowed origins in that web integration.

 

Labels (2)
Comments
Claudiu_Anghelescu
Specialist
Specialist

Hi,

I'm trying to embed a chart using iFrame on my website www.claudiuanghelescu.xyz from Qlik Sense Business Cloud but I receive the error:

Claudiu_Anghelescu_3-1612041327791.png

 

I already configured the settings.

Claudiu_Anghelescu_4-1612041377268.pngClaudiu_Anghelescu_5-1612041396474.png

 

Is it needed to have HTTPS instead of HTTP?

Damien_Villaret
Support
Support

Hello @Claudiu_Anghelescu 

Yes, you should use HTTPS, otherwise the browser will block the request for "Mixed content"

Claudiu_Anghelescu
Specialist
Specialist

Thank you!

I've installed SSL certificate to use HTTPS and now it's working.

Claudiu_Anghelescu_0-1612873196372.png

 

There is a way to keep authentication always open, maybe using  a token?

The chart is visible only if I'm authenticated on the tenant, otherwise I receive the below message:

Claudiu_Anghelescu_1-1612873287022.png

 

Damien_Villaret
Support
Support

Hello @Claudiu_Anghelescu 

If you've followed the example in this article, it is expected that you are redirected to your Identity Provider if you are not logged in yet when you open your site.

At this moment, it's not possible to provide an authentication token, but it is on the roadmap, stay tuned.

manuelvallejos90
Contributor
Contributor

@Damien_Villaret please let me know when you have the authentication token available, otherwise i should buy a aditional analyzer licence 

Claudiu_Anghelescu
Specialist
Specialist
I bought the professional licence thinking that I will be able to share my insights as interactive dashboards/charts with other people on my blog/personal website. Has no sense to ask for login.

For example Tableau has Tableau Public, through PowerBI I can publish my work; and everything is for free. Even if I paid for Qlik Sense, the result is not as expected.
manuelvallejos90
Contributor
Contributor

@Damien_Villaret  i bought Sense Cloud Enterprise a few months ago and I want to know when will be released the authentication token feature

Jeffrey_Goldberg
Employee
Employee

@manuelvallejos90 when you say authentication token what do you mean? Are you asking about JWT capabilities or OAuth2 or something else?

manuelvallejos90
Contributor
Contributor

@Jeffrey_Goldberg I need to share sheets on my intranet to show others without asking to log in, that is what @Damien_Villaret said it's on the roadmap

Version history
Revision #:
8 of 8
Last update:
‎2021-02-25 04:17 AM
Updated by:
 
Contributors