Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Embedding single AJAX chart objects in HTML document

I know this has been discused a lot but I can't find an example of the complete solution so I try to make myself as clear as possible.

QV Server Version 10.0.0.x

I have sucessfully created AJAX pages on the server so there is no technical problems. I use the code in opendoc.htm that loads the toolbar, sheetheaders and all the objects on a sheet. As long as the code

<div id="PageContainer">

<div id="MainContainer"></div>

</div>

is included all the objects are nicely arranged as in the QlikView .qvw file. No problem so far.

But I want to take one single object from the page and put it in a table without the toolbar, tabs and other objects. I have seen solutions for QV7,8,9 etc but none seen to work. The generally seem to have the form:-

In the header

<script javascript etc....>.

var qva;

var qva = new Qva.PageBinding();

qva.View = "QLM";

qva.Autoview = "";

qva.AuthenticateUrl = 'QvAJAXZfc/Authenticate.aspx';

new Qva.Scanner(qva);

... </script>

In the body of the document is a table <table style="width:auto;" avq="graph:.CH01" class="Chart"></table>

or something similar.

This produces no errors but does not show anything either.

Anyone know what is missing?

Thanks for any help.

26 Replies
Not applicable
Author

Hi,

did someone get this running in QV11? I tried to modify the file singleobject.htm and open it with

http://localhost/qvajaxzfc/htc/singleobject.htm?document=Testdaten.qvw&select=LB03,A

Testdaten.qvw is a simple document with test data and also a listbox LB03. But my page is simply empty, i don't even get an error...

I inserted the divs inside the MainContainer-DIV, is that wrong?

  <div id="MainContainer">
   <div>    
      <div class="QvFrame" avqview="QLM" avq="object:.Document\TB01" id="Document\TB01" style="float:left;display:none;width:460px;height:258px;">                   
      </div>                      
      <div style="float:left;width:10px;height:258px;">                   
      </div>                      
      <div style="float:left;">                                
   <div class="QvFrame" avqview="QLM" avq="object:.Document\LB03" id="Document\LB03" style="display:none;width:100px;height:150px;">                             
   </div>                                
      </div>                      
   </div>
  
   </div>

thanks a lot,

Martin

Not applicable
Author

I have upgraded to v11 and have managed to get my implementation working again. There was one line in my original code that I had skipped as it didn't seem necessary but it is needed in v11 (new Qva.Modal();). Here is the new HTML fil from start to finish.

Important things include: call to init() in the <body> tag, paths to the AJAX client files, css and .js files, authentication.

Good luck.

Andy

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:zfp="http://www.qliktech.com/zfp" xmlns="http://www.w3.org/1999/xhtml">                         
  <head>                                                
    <title>QlikView SingeObject integration in HTML                                           
    </title>                                                
    <meta http-equiv="X-UA-Compatible" content="IE=9; IE=EmulateIE8" />                            
    <link rel="stylesheet" type="text/css" media="screen" href="http://vm-qlikview/QvAjaxZfc/htc/default.css" />                            
    <link rel="stylesheet" type="text/css" media="screen" href="http://vm-qlikview/QvAjaxZfc/htc/modal/modal.css" />                            
    <link rel="stylesheet" type="text/css" href="https://community.qlik.com/QvAjaxZfc/htc/avq.css"/>                         
<script type="text/javascript" src="/QvAjaxZfc/htc/QvAjax.js"></script>                         

<script type="text/javascript">
    <!-- // Script for QlikView AJAX integration -->
        var qva;
        function Init() {
           
            qva = new Qva.PageBinding('QLM');   //can have several binders each with their own doc and authentication etc.
           
            var doc = Qva.ExtractProperty("document", null);
            qva.View = doc;      //qva.View should be the relative (to the root document folder) application name on the server. Do not include the .qvw extension.

            new Qva.Modal();

            new Qva.Scanner();           

            qva.Autoview="";
            qva.AuthenticateUrl = '/QvAJAXZfc/Authenticate.aspx';
//--            qva.Host="Local";

       
            Qva.BodyOnLoadFunctionNames.push('MyInit');

           Qva.Start();
        }
</script>                                  
  </head>                         
  <body onload="Init();"> 
    NY: http://vm-qlikview/QVajaxIntegration.htm?document=MyQVdoc<br>

    <p style="width:50%;">
    Create a Qlikview file with objects CH02, LB01, LB03 and place it in the server catalogue.
    </p>
    <p><hr></p>                          

    <div class="QvFrame" avqview="QLM" avq="object:.Document\CH02" id="Document\CH02" style="float:left;display:none;width:790px;height:458px;">                         
    </div>                            
    <div class="QvFrame" avqview="QLM" avq="object:.Document\LB01" id="Document\LB01" style="left:800px;width:100px;height:150px;">                                   
    </div>                                      
    <div class="QvFrame" avqview="QLM" avq="object:.Document\LB01" id="Document\LB01" style="left:800px;top:560px;width:100px;height:98px;">                                   
    </div>                            
  </body>
</html>

Not applicable
Author

Hi,

I'm trying to get andy.hyde's code to work : it works perfectly on the Qlikview server but I still have these cross-domain issues if i run it from a remote server ("Access Denied" in my browser's console error), The solution from roelandl doesn't help with my configuration & QV 11.

Has anyone succeeded in embedding QV objets on a web app from a remote server with QV11 ?

Does Qlikview offer an "official" support / solution for that kind of use?

Thanks.

Pierre

Not applicable
Author

Hi Pierre,

the QV js lib uses XMLHttpRequest objects for communication, like any other AJAX lib. Browsers just don't allow those to be posted to another server/port/protocol, due to the same origin policy (see for instance http://en.wikipedia.org/wiki/XMLHttpRequest#Cross-domain_requests). QV10 does not offer an official solution for this, so I expect the same goes for QV11.

Although the policy exists for a reason, there are several solutions/workarounds (in general, also summarized on the aforementioned web page). I used flXHR as explained above since that way the QV source can be left untouched. If flXHR doesn't work for you (but are you sure it is deployed as documented, using a crossdomain.xml file and everything?), maybe you can get some alternative to work.

Another possible direction: did you get the "Access Denied" with or without using flXHR? Maybe you just need to supply the right credentials. I normally get an HTML authentication popup when credentials are required, but it depends on the QVS/IIS configuration whether basic access authentication is enabled or not. Maybe you should look into this.

Good luck,

Roeland

Not applicable
Author

It is a while now since I played with this but if I remember rightly I got it to work in an iFrame. I know I had my intranett showing objects that were running on the qlikview web server.

I'll see if I can't find my old code.

Not applicable
Author

Thank you roelandl for your help.

I tried to use flXHR as you recommended but i get :

- a "security sandbox error occurred with the flXHR request" in flensed.js using the adaptNative() method. (IE 😎

- same error on firefox with, on the status bar, "Data transmitted from [the qv server ip adress]" (?)

I also tried setting this before the Qlikview library is called :

// set flXHR as the default XHR object used in jQuery AJAX requests

$.ajaxSetup({transport:'flXHRproxy'});

// set up the domain that we're going to call and tell flXHR not to try to parse the response as XML..

$.flXHRproxy.registerOptions(serverIpAdress,{xmlResponseText:false,loadPolicyURL: ip + "crossdomain.xml"});

But it doesn't work better. (I don't get the authentication popup).

In IE8 : IE crashes ("A script on this page is causing Internet Explorer to run slowly ... ")

In Firefox, i get a "Failed to authenticate" popup.

I also tried to set the authentication mode from "Always" to "Never" on Qlivkiew webserver configuration page.

andy.hide > it would be great, thanks !

Note :

If I add the Qlikview server IP in the "Local Intranet Zone" list in IE, without using flXHR, i also get the "Failed to authenticate" popup.

Not applicable
Author

For other people (hopefully you found out yourself by now, I was busy at the time) looking for answers: the "security sandbox error" is what you get when flXHR is not properly deployed (see flXHR documentation), in particular when you didn't grant the required access in crossdomain.xml.

It has nothing to do with the authentication in QlikView and I also never had to change any browser settings.

By the way, I don't really recommend using flXHR unless there is no other way.