Hi, when I try to open an HTML file on the local disk I am getting a warning that the operation cannot be completed due to the security issue etc.
Is there a way to overcome that security issue?
Thank you,
Val
Hi, when I try to open an HTML file on the local disk I am getting a warning that the operation cannot be completed due to the security issue etc.
Is there a way to overcome that security issue?
Thank you,
Val
This sequence works:
Var ff as FolderItem, tmpof as TextOutputStream, MailBody as DesktopHTMLViewer, htmlbody as String
ff = new FolderItem ("/path/to/temp.html", FolderItem.PathModes.Native)
tmpof = TextOutputStream.Create (ff)
tmpof.Write (htmlbody)
tmpof.Close ()
MailBody.LoadPage (ff)
In other words, I have the html already in memory in the app as a string, then have to write it out to a file.
Hi, Tim,
Thank you for the advice.
Iâve done a slight modification of your sequence but for some reason, the HTMLViewer shows a blank page.
Var ff as FolderItem, tmpof as TextOutputStream, MailBody as DesktopHTMLViewer, htmlbody as String
ff = FolderItem.ShowOpenFileDialog("text/html")
tmpof = TextOutputStream.Create (ff)
tmpof.Write (htmlbody)
tmpof.Close ()
MailBody.LoadPage (ff)
What do you have in âhtmlbodyâ?
Hi, Alberto,
I currently have nothing in âhtmlbodyâ. What should I put there?
Tim is writing the HTML to a file. âhtmlbodyâ is a string that already has the HTML that need to be displayed.
Yes, the way to do this has changed a bit over the years. I used to be able to load the html (as a string) straight into the Viewer. Then that no longer worked (on Windows, IIRC), but I could write it to a file and then load the folderitem (as above). Then it no longer worked on Linux (or maybe macOS, canât remember) any longer, so I just decided to always write it to a file.
Trouble is the doc doesnât keep up with all these changes.
Seems to me you will overwrite the file you selected.
Which OS are you on? Writing to the hard disk definitively is not necessary for macOS. Canât say about Windows or Linux.
Hi, all,
Thank you for your replies. I guess providing a little bit of a background might be helpful.
Back in 2017, Iâve created a virtual tour using PanoGiga (creates 360-degree panoramas) and Panotour (creates virtual tour). The tour consists of an HTML file and a data folder with all the panoramas.
I tried to open the tour on Mac and Windows and both platforms had a message that opening local HTML files were not secure. After Googling, I made some changes to the Firefox browser on macOS, and now it opens the tour.
To make sure users can open the tour without making changes to their browsers, I thought of creating a customized browser in XOJO.
On a separate note, the HTML file of the tour is blank. I do not know how Firefox is opening the tour but it does it with no problem (after making changes to the security settings).
Now Iâm puzzled. Upthread you are talking about a DesktopHTMLViewer. What does that have to do with FIrefox?
Can you provide the panarona folder for us to debug?
I think they are describing their previous solution, which used to launch the files to the local default browser. Now they want to provide an HTMLViewer.
Ah, righto - thanks.
The only reason why I mentioned Firefox was the confirmation that the HTML file is working even though it is totally blank.
I would love to share the panorama folder but it is 4.1 GB. Each roomâs 360-degree panorama was built out of 42 images. The total number of rooms is 10 or 11.
Here is the link to the folder on the pCloud
If you have the MBS plugins, on macOS you can add the following to the Opening
event of the DesktopHTMLViewer to allow opening Safariâs JavaScript Console and Web inspector.
// - when true: contextMenu should show "Reload" & "Inspect Element" (devtools)
Me.WKWebViewMBS.developerExtrasEnabled = True
This will allow you to confirm the viewerâs content and see if there are any internal errors.
Unfortunately, I do not have the MBS. My license expired back in 2007 or 2009.
If you have a folder of content, including the HTML file you wish to load, you should need only to load the HTML file in to a DesktopHTMLViewer instance with DesktopHTMLViewer.LoadPage(source as FolderItem)
. Something like:
Sub Opening() Handles Opening
var path as FolderItem = SpecialFolder.Resource( "FolderOfHTMLContents" ).Child( "index.html" )
me.LoadPage( path )
End Sub
Judging by the size of the content, I donât expect youâd be distributing this with the app, so youâd change the path
line to point to wherever you are actually storing the data. If you do plan to distribute all of that content, then youâd add a build step to copy the content to distribute to the Resources folder.
You donât need to create files or anything of the sort if you already have a working HTML source with relatively located resources.
Downloading that much data to help you test will take hours. You should start simple and build from there. Create a minimum viable example package.