Using Iframe in Cordova

Hi,

Is it possible to use an Enterprise license from a Cordova app?

Design: The Cordova app uses a iframe that points to our registered domain to render the document

When using a embed tag we receive a license warning or "Doconut is licensed to xyz, iframes not allowed for this url: "
From an iframe an image is rendered: “You are not authorized to view this page”

Thanks

W

@Willemf,

EDITED…
Look at the last post.

Will it be possible with a Distribution license?

@Willemf,

EDITED…
Look at the last post.

@Willemf,

After some testing on a regular website, if you want to run in an unsafe mode, you can use the following configuration:

<appSettings>
    <add key="DoconutUnSafeMode" value="true"/>
</appSettings>

You also need to have an Enterprise license if you own the target and source domains or a Distributable license if you do not own the domain.

I am not sure if this configuration is going to work in Cordova. This was tested in an IIS server.

Hi,

We applied the upgrade license, but receives the following error:
“Init error. Please make sure your web.config has the handler declared. Refer web.config in our sample project or change the BasePath property value. Handler is: DocImage.axd”

And the following image is returned:
YouAreNotAuthToViewThisPage.png (1.1 KB)

In essence the DocImage.axd returns a image that says you are not allowed to view the page.

  1. We do set the base path as docViewer.BasePath = “”;
  2. We’ve added the to the web.config

How to replicate:
Create a Test.html thats hosted on localhost
Add an Iframe using

In the network trace it will produce something like: https://try.doconut.com/DocImage.axd?Init=1&Zoom=75&token=1c8a1551-c1ad-4719-9f7a-87a7d16b218f&rnd=301695799850237&doc=1&format=png

I understand that the license on https://try.doconut.com/mobile.aspx might not be the same as our distribution license.

@Willemf,

Let’s clarify some things. The only site that needs Doconut configuration is the source site, the one that will be displayed on the iFrame, not the one with the iFrame itself.

The site that is hosted at try.doconut.com does not have the correct configuration to be displayed in an iframe, which is why the page on mobile.aspx is not been displayed.

For the sake of testing, we displayed a very simple sample on iframe.doconut.com. That site will be displaying what is in minimal.doconut.com.

You need to have the following appSettings “DoconutUnSafeMode” with true value on minimal.doconut.com web.config. An example is:

  <appSettings>
     <add key="DoconutUnSafeMode" value="true"/>
  </appSettings>

Be sure to not have any other configuration that can block an iframe, like having incorrect CORS tags.

The content of the page iframe.doconut.com:

<html xmlns="http://www.w3.org/1999/xhtml">
<body>
    <form id="form1">
        <div>
	        <h1>Iframe source is minimal.doconut.com</h1>
            <iframe src="https://minimal.doconut.com/" height="500" id="docframe" frameborder="4" scrolling="no" width="80%"></iframe>
        </div>
    </form>
</body>
</html>

Thanks for the response.

The config is applied on the source/remote domain and not on the test site. The CORS settings was to see if it made any difference.

When rendering the iframe the following message pops up:
“Init error. Make sure your web.config has the handler declared. Refer web.config in our sample project or change the BasePath property value. Handler is: DocImage.axd” and then “Init error or Invalid Token. The document might be closed. Current path is: DocImage.axd”

The server side code:
DocViewer docViewer = null;
docViewer = this.FindControl(“ctlDoc”) as DocViewer;
docViewer.BasePath = “”;
docViewer.OpenDocument(Convert.FromBase64String(doc), response.ResourceContentType);

Web.config: (extract)
<system.webServer>










</system.webServer>

HandleConfig.png (33.4 KB)

The handler is correctly declared and tested using the methods in the document:

  1. When going to the URL directly (without iframe) it works without any issue.
  2. When accessing DocImage.axd without an iframe it displays “Doconut 1.0.2.2 is running on https://remotedomain
  3. When running DocImage.axd from an Iframe the “Doconut 1.0.2.2 is running” message is displayed.

Regards,

W

@Willemf,

Do you have this setting in your web.config file?

  <appSettings>
     <add key="DoconutUnSafeMode" value="true"/>
  </appSettings>

Try again removing this line in your code:

docViewer.BasePath = "";
  1. The DoconutUnSafeMode appSetting is definitely set to true.
  2. DoconutShowInfo is also defined as true (and working)

The same errors are displayed when removing the BasePath property. I’ve also tried to use the full path (https://remotedomain), but it seems that it only allows relative paths.

Regards,

W

@Willemf,

Only to clarify, is the source website working by itself, I understand the source website is not working.

If it’s not working, can you send me a zip file with a demo of the website that is not working?

@gabriel.vega,

The source site is working 100%. It also works if the “iframe” domain is from the same “domain”. (if the BasePath is set to “”). It does not work if the “iframe” domain is not from the same domain. We upgrade the licenses to have a no domain restriction. (domain=*)

@gabriel.vega,

Can you please check the web.config and server code for minimal.doconut.com? Minimal does not give the init error (just a license error when using from a different iframe)

Thanks

W

@Willemf,

I can use an iframe with the source in minimal.doconut.com from a local HTML file on my computer which is not part of the doconut.com domain and it works fine, without the init error.

Can you send us the complete web.config file you are using? You can change any private information, but not delete any nodes because we are going to use it to run an example app.

Sorry, I missed your reply. Please see attatched

WebConfig.zip (1.6 KB)

@Willemf,

I attached two small projects with an example that is working successfully.

The MinimalSrcIFrame project has the same web.config you shared with us. The MainDomainTestMinimalIframe project loads the iframe and shows the viewer without issues.

This example was tested with the Enterprise license.

Willemf-ApacheCordovaIframeIssue.zip (660.3 KB)

Thanks, busy checking