HTMLViewer Using ONLY http:// behind network firewall

Mac HTMLViewer question: I’m trying to get HTTP to work behind a network firewall for an internal application using HTMLViewer. There is no SSL and never will be so showing HTTPS:// content is not an option. I DID figure out how to add the correct AppTransportSecurity plist entries into the app after its compiled by editing the info.plist file in the complied applications file folder.

How can I add the entries into the app itself so I can preview and test the app BEFORE I compile it?

I read someone said just drag the entries into the project, but when I drag the info.plist into the project nothing happens when I preview the app? Am I missing something here. Does it need to be some other file format like XML or TXT or something?

Treat me like a newbie here, I am trying to learn here and please don’t post links the the App_Transport_Security page, because it tells you the protocol (Which I did figure out) - It just does not tell you how to implement it in your app before you compile, so that page doesn’t really help me. Any genuine step by step so I can learn would be helpful.

Thanks.

Make a file containing:

[quote]<?xml version="1.0" encoding="UTF-8"?>

NSAppTransportSecurity NSAllowsArbitraryLoads [b](or whatever you need here)[/b] [/quote]

then drag/drop the file into the IDE’s navigator (left-most) column. That should create an alias to your plist file which will get incorporated into the built app.

I’ve added this code to a info.plist, info.txt and a info.xml file and drug them into the side bar. None of them do anything when I preview the app or when I build it. Does it matter the file name?

[code]<?xml version="1.0" encoding="UTF-8"?>

NSAppTransportSecurity NSExceptionDomains *********** [b]<-- I hid the actual domain, but it works when added to the plist after build[/b] NSIncludesSubdomains NSTemporaryExceptionAllowsInsecureHTTPLoads [/code]

You can do this via the Apple command line tool PlistBuddy and a Xojo post build script.

The Xojo build script would be something like:

[code]
Dim appName As String
Dim appPath As String
Dim plistPath As String
Dim domainName As String
Dim scriptCommandsArray(-1) As String
DIm shellCommandResult As String

'build the plist path
appName = CurrentBuildAppName
appName = ReplaceAll(appName, " ", "\ ") // Escape spaces for the command line

appPath = CurrentBuildLocation + “/” + appName + “.app”

plistPath = appPath + “/Contents/Info.plist”

'build the command
domainName = “mydomain”

scriptCommandsArray.Append("/usr/libexec/PlistBuddy -c ‘Add :NSAppTransportSecurity dict’ " + plistPath)
scriptCommandsArray.Append("/usr/libexec/PlistBuddy -c ‘Add :NSAppTransportSecurity:NSExceptionDomains dict’ " + plistPath)
scriptCommandsArray.Append("/usr/libexec/PlistBuddy -c ‘Add :NSAppTransportSecurity:NSExceptionDomains:" + domainName + " dict’ " + plistPath)
scriptCommandsArray.Append("/usr/libexec/PlistBuddy -c ‘Add :NSAppTransportSecurity:NSExceptionDomains:" + domainName + ":NSIncludesSubdomains bool true’ " + plistPath)
scriptCommandsArray.Append("/usr/libexec/PlistBuddy -c ‘Add :NSAppTransportSecurity:NSExceptionDomains:" + domainName + ":NSTemporaryExceptionAllowsInsecureHTTPLoads bool true’ " + plistPath)

'execute the command
shellCommandResult = DoShellCommand(Join(scriptCommandsArray, “;”))

If Len(shellCommandResult) > 0 Then
Print "Command Failed: " + shellCommandResult
End If[/code]

The filename does matter. it can be named anything but must have a .plist extension.

But you’re missing a dict close tag, fourth line from the bottom… try this instead:

[code]<?xml version="1.0" encoding="UTF-8"?>

NSAppTransportSecurity NSExceptionDomains *********** NSIncludesSubdomains NSTemporaryExceptionAllowsInsecureHTTPLoads [/code]