Open an HTML file from Power Apps and host it within your solution

Recently there was a need to open an HTML file from Power Apps canvas app and to even pass URL parameters to it. It sure is easy to open a desired URL from canvas app simply by using the Launch function. However, the problem in the project was where to host the static HTML file??? All UI components in the project were implemented via Power Apps canvas apps, so it felt like overkill to have the HTML deployed onto some hosting platform such as Azure App Service. We did try various other approaches, such as hosting the file in SharePoint Online, but they didn’t work as expected (e.g. SharePoint forced the HTML file to be downloaded).

So I wanted to find out whether there was a way to host the file on Power Platform. And as it turned out, there is!

I created a test solution and validated that it works. Below are the steps to make it work for you.

First, create HTML file. I used this simple content to validate correct functionality:

As you can see, I expect all URL parameters that I need to be passed on my page as URL encoded in data parameter.

Next I need to use the HTML file as a Web resource in my solution. So, go to your solution and add one.

On the web resource edit page you can now give your resource a Name (will be part of the final URL), Display Name, Description, Type (choose Webpage (HTML)) and you can also upload your HTML file.

Save and publish you Web resource. Copy the URL value that gets generated automatically after saving.

After you have published your Web resource, you can go ahead and edit your canvas app so that a correct HTML file is opened for the user. I created the following simple app to try things out:

The code that I use to generate the URL (visible in the label) is quite simple:

https://your-d365-tenant.crm4.dynamics.com//WebResources/crd3a_TestHtmlPage?data=” &
EncodeUrl(“testparam=” & TextInput1.Text & “&testparam2=” & TextInput2.Text)

Note that the part after data= is all URL encoded! 

Then just simply open the URL when the user clicks on the Open URL button:

Launch(Label1.Text)

That’s it! This way you can deliver required static HTML files along with other parts of your solution – easy and neat!

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s