About Web API 2.0 URL mapping

In older versions of Web API 1.0, we were able to copy our HTML documents to " Resources"The Resources folder, such as a.HTML, and then use "/ Framework/a.HTML "to access or insert an HTMLView control wherever you want. But this method does not work in Web API2.0, so how to implement it in the new version?

In Web API 2, it seems that both the shortcut icon and apple touch icon properties are invalid.

<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="shortcut icon" type="image/x-icon" href="[/framework/favicon.ico](http://127.0.0.1:8080/framework/favicon.ico)">
<link rel="apple-touch-icon" href="[/framework/homescreen60.png](http://127.0.0.1:8080/framework/homescreen60.png)"/>
<link rel="apple-touch-icon" sizes="76x76" href="[/framework/homescreen76.png](http://127.0.0.1:8080/framework/homescreen76.png)"/>
<link rel="apple-touch-icon" sizes="120x120" href="[/framework/homescreen120.png](http://127.0.0.1:8080/framework/homescreen120.png)"/>
<link rel="apple-touch-icon" sizes="152x152" href="[/framework/homescreen152.png](http://127.0.0.1:8080/framework/homescreen152.png)"/>

All of these HTML attributes lose their meaning because the / framework path fails

The fact that the /framework path worked for you was a happy accident which is no longer possible. If you want functionality like that, you can do it in the App.HandleURL event using your own path.

In fact, this is very useful, for example, I can put some javascript documents under this path, and I can access them through this relative path, such as chart.js, etc.

I think the shortcut icon and Apple-touch-icon properties for WebAPP are still bugs that should be fixed in later releases.
In Xojo 2020 R1, Web apps will no longer have their own Logo.

We are aware of that and already have two bug reports. Please don’t report it again.

While I agree, it also means that a user on the web can access any file in the resources directory without the developer’s consent.

I think there could be a compromise, such as adding a developer-specified resource file in the next generation Xojo and specifying a static URL, which would reduce the complexity of using Webfiles with more files.

Could it be an acceptable idea :bulb: to have a public folder :file_folder: next to the webapp and have file in it being served automatically. So of that folder :file_folder: is not existing or a file in it is not existing 404 will be given?

Indeed, while a WebFile can do what it wants, it must be defined in code, and if it is a series of files, this operation becomes tedious.
Second, if you really want to secure your application resources, you might recommend that the XOJO IDE do a HASH dictionary for the imported files to ensure that the corresponding files are not replaced. For example, some images containing logos or copyright information in WEB applications have been tampered with.
The APP can quickly verify the legitimacy of the file before the resource is used, and if it is replaced, it may not appear or be available

What I’d really like to see is a feature request in Feedback describing the things that you need it to be able to do so we can figure out how to accomplish everyone’s wishes at once.

1 Like

I want the function to look something like this

Demo2

'Use url
self.HTMLViewer1.LoadURL("/Resources/docs/a.jpg")

'Use file
self.HTMLViewer1.LoadHTML(xojo.resouces.chartjs.readalltext)
1 Like

That’s great! now please put it in our Feedback app as a Feature Request, because here, were just two people talkin. :wink:

3 Likes