I am implementing InAppWebView in my Flutter Project. I am loading local files from assets which contains all Javascripts and CSS files.
Expected behavior: I want to pass query parameters with local file path. For example, assets/board/index.html?letter=5&mode=1
Current behavior: Like, currently I am passing assets/board/index.html and Its loading file successfully. but Its not working If I pass as above path (assets/board/index.html?letter=5&mode=1). I am not getting any error but its just showing blank white page.
P.S. It is working for same URL if I host somewhere and use initialUrlRequest.
For more detail, check here.
Do let me know if any other information you need. Kindly help.
Related
I'm running html2canvas in 2 different places within my sites structure.
When I use it to capture elements in the root of the site it works. ie, when run in http://192.168.0.1/test/ it works correctly.
However if I run it in http://192.168.0.1/test/**subfolder/** the canvas image is shown but no css or png files have been rendered in it.
Looking at the console html2cavnas is failing to load items from http://192.168.0.1/test/images/ or http://192.168.0.1/test/css/
But it should be looking in
http://192.168.0.1/test/**subfolder**/images/ or http://192.168.0.1/test/**subfolder**/css/
How do I get it to read the URL correctly ?
Thanks
I've looked up many topic but none seems to do what i need.
I am working on a website with flutter and i need to read a file thats located on the server.
Is this in any way possible?
Edit: The contents in this file change, so i have to update the contents on the website.
If you want to be able to access the file as if it was locally stored, then it needs to be registered under your assets in your pubspec.yaml & should be included in the project itself. Otherwise, you will have to fetch the file using something like DIO to fetch it from wherever it is hosted.
I'm using file_picker which give the path to the file in mobile, but in web the path is always null.
I read somewhere you can get the bytes of the file, but I couldn't understand how this it's done.
Right now I am trying to pick a video and showed on my web page with video_player, this method accepts a File.
So, is it possible to get the path of my video somehow and transformed to File?
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.
Hi I am new on moovweb and I got stuck on a requirement to apply transformation logic on ajax response which is coming in a json format containing html, which I have to add on my page.
A sample response
{
"success":true,
"html" :"<div>This can be a big html data</div>"
}
SO basically, I need to apply transformation on that html string. I gone through docs but I did't got anything to handle this kind of scenario.
Is there any way to do it?
If I understand your question correctly then there are several steps that you need to take in order to solve this issue.
Open your Moovweb project using Google Chrome, right click your mouse and choose Inspect Element which will open your Chrome Dev Tools.
Choose the Network Tab at the top of your Chrome Dev Tools which will be the second tab from the left.
Trigger the ajax call on your site and you will see under the Network Tab the response URL of the ajax call. Most of the time it will be in a format like www.yoursite.com/ajax/rest_of_url
Once you have found the ajax response URL then open your main.ts file in your tritium script and insert the following code if your response URL is similar to the format provided above:
match($path){
with(/ajax/){ #or wherever the site files for the ajax response are contained
log("--> importing ajax.ts")
#import ajax.ts
}
}
Now created a file in for your tritium code called ajax.ts. The file will be in the same location as your html.ts and main.ts files. With the code applied above to your main.ts, every time a URL is called that contains /ajax/ then the ajax.ts file will be applied.
Now you can open your new ajax.ts file that you created and start applying your tritium functions to transform the json format containing html to way you need it.