How to set "allow-file-access-from-files" in CEF4DELPHI? - cef4delphi

I'm trying to create a program that load a html page that is in a localfolder, and this page has implemented some javascript resources (ex:pdf.js) that load a local pdf file.
Every time that i tried to run the program i get this error: "Fetch API cannot load file....URL scheme "file" is not supported"
The local html file is loaded but the javascript cannot load the pdf.
I know there is the --allow-file-access-from-files flag, but i don't find the way to set this flag in Cef4delphi.
How I can set --allow-file-access-from-files flag on CEF4DELPHI?

Set the GlobalCEFApp.AllowFileAccessFromFiles property to True before the GlobalCEFApp.StartMainProcess call in the DPR file and CEF4DElphi will add that flag for you automatically.
If you need to use any flag/switch that it's not available as a GlobalCEFApp property just call the GlobalCEFApp.AddCustomCommandLine procedure before the GlobalCEFApp.StartMainProcess call.
However, that Fetch API error is sometimes shown when you register a custom scheme. Try registering the "http" or "https" schemes instead.

Related

IONIC 4: How to call iOs file resource from custom script within app

Here is the situation:
Ionic 4: (cli-5.2.7)
XCode 10.3
We have a custom eReader that lives in our assets folder.
When we want to download an eBook from our server and read it, we download the file and save it using the Native File plugin.
When we start up the reader, we send it the container in which we want the reader to be created and built, and an internal url to the file resource we want to read.
After window.Ionic.WebView.convertFileSrc, the file ref looks like:
ionic://localhost/_app_file_/var/mobile/Containers/Data/Application/[APP-ID]/Library/NoCloud/[BOOK-ID]/vol-001-chapter-006.xhtml
The reader will then build the iframe and send a simple XMHttpRequest to the provided url, then place the resulting html into the iframe.
The problem is that it only works on first load of the eBook from our server
I can see the file being downloaded, and written to its own folder in the apps file system (File.dataDirectory).
When I debug the XMLHttpRequest in our eReader.js, I can see the call being made to the resource and the HTML returning to the request, which is then rendered on the page.
BUT, if I close the app, reopen it, and try to access the already-downloaded book, the XMLHttpRequest in our eReader.js returns nothing.
I can verify that the file exists at the resource location after a reload, but the XMLHttpRequest acts like it cannot find anything at the provided location.
AND, this is only on iOs. Android works as intended.
My questions is, what am I missing? Is this something to do with the iOs permissions or persistence?
Any help would be appreciated.

SAPUI5 load file in the workspace

I need to upload files in the Workspace:
I dont know which URL i should give as parameter to my file Uploader. Considering that i working with the SAP WebIDE personal Edition and my file are located in the following path:
file:///C:/SAPWebIDE/eclipse/serverworkspace/Al/ALine/OrionContent/testApp/webapp/model/
What should i please set as Url here?
var oFileUploader2 = new sap.ui.commons.FileUploader({
name: "upload2",
uploadOnChange: false,
uploadUrl: "???"
});
I think you have misunderstood how the FileUploader works.
The "uploadUrl" parameter should be used to specify a path on the "web server" (e.g. application server, web container) on which your application is hosted. UI5 is a web user interface framework, it does not know how to handle (server-side) upload requests. This means that the server (backend) itself should have some implementation for handing the file upload.
After you select the file and trigger the upload, a POST HTTP request is made to the path specified in this "uploadUrl" parameter. If you have no web server to know to handle it, then it will invariably give back an error HTTP response.
Based on the title of your question, I understand that you would want to upload the file inside your workspace. IMO, this does not really make sense (as you are mixing in the design time environment with your run-time environment (i.e. your application should never depend on the IDE).
Nevertheless, you can try and import a file via the import menu (right click on package, import, from file system) and see what URL is the request triggered against (using the dev console). I looked around a little and roughly this is the request URL: http://localhost:[Web IDE Port]/xfer/import/[User Name]-OrionContent/[Project Name]. In the Slug header you would have the file name. You might not be able to make a POST request towards this URL directly (because of XSS / CSS limitations), so you might need to create a route mapping for it.

GWT.getModuleBaseURL() returns an incorrect value

I am running a GWT application in development mode out of Glassfish 3.1.1 (launched with a -noserver argument).
When I call GWT.getModuleBaseURL(), the following URL is returned: http://localhost:8080/appName/appName/
The correct URL should be http://localhost:8080/appName/. I wonder what I did wrong, so that the application name is appended twice.
By the way, GWT.getHostPageBaseURL(); returns the correct URL.
Your comment is spot on - that is what getModuleBaseURL() does, it returns the path to inside the compiled module, where the generated JavaScript and images are stored. If you launch the app from the url http://localhost:8080/appName, that is the host page, but if you look in firebug or another inspector, you probably see a request for http://localhost:8080/appName/appName/appName.nocache.js which is the bootstrap JS file. It is the directory where that is contained that the module base url refers to.

How to Intercept image load requests in WebView?

Is it possible to intercept image load requests in WebView before they are actually started and modify their URLs?
For example, I have
mWebView.loadUrl(myUrl);
In onLoadResources event I can see URLs, but I can't modify them?
The thing is I am working on application that loads html content from remote location. For some reason author excluded image path and in img src he just have file name. Existing iPhone application is using this html content and I assume the content is build the way that is the best for iPhone. So, I need somehow to figure how to alter these paths. For example, if I choose to download all images first, I would need to alter path and add file:///... in front of image.jpg name.
Thanks.
you can use onLoadResource although are not only images but any resource loaded like javascript and css

Associating a custom preview URL with a .cfm file in ColdFusion Builder (Eclipse)

In my usual ColdFusion directory layout all files are accessed via a controller called r.cfm that uses an include to pull in the actual .cfm file, so a file called "salaries.cfm" would be invoked via http://servername.com/r.cfm?name=salaries
In Eclipse with the ColdFusion extensions I could set the file properties so the default url for salaries.cfm would be http://localhost/r.cfm?name=salaries - when I ran the debugger that url would launch, not http://localhost/salaries.cfm - how do I set that up in the ColdFusion Bulder beta, the debug configuration is always non editable per file.
I have played around with server prefixes but that does not seem to do it.
Thanks for any tips
I don't think this is currently possible in CFBuilder -- as you said, this setting is not per-file. You could put in an Enhancement Request, though, if you wanted: https://bugbase.adobe.com