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:
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:
That’s it! This way you can deliver required static HTML files along with other parts of your solution – easy and neat!