I want to open an HTML file in the browser. All documentation/answers online suggest that the following is what I should have in my routes file:
GET /test controllers.Assets.at(path="/public/html", file="test.html")
Where test.html is located in public/html. However, when I go to /test, test.html is downloaded when I want it to just open in the browser (which I think is the expected behaviour of the .at function).
This has only started happening recently and no changes have been made to routes file or html file.
Any idea what might be causing this?
To serve an HTML file, you should have a Result. Results are defined within the controllers. For example:
def example = Action {OK(views.html.myhtml)}
Looks for the file myhtml.scala.html within the views folder. And here the controller method serves the result ok (http status 200) with that html file.
The asset folder is for ... well asset files which then can be used within the webpages: javascript/css/image files.
Related
With file_picker, I can't get file's real path or URI from FilePicker.platform.pickFiles(). It only returned something like this
/data/user/0/my_app_dir/cache/file_picker/file
and logged this
I/FilePickerUtils(27005): Caching from URI: content://com.android.providers.media.documents/document/video%3A1519
D/FilePickerUtils(27005): File loaded and cached
at:/data/user/0/my_app_dir/cache/file_picker/file
D/FilePickerDelegate(27005): File path:[com.mr.flutter.plugin.filepicker.FileInfo#705d9ef]
That's not what I want. I just want the real original absolute file path, the file information, regardless of what I'll going to do with the file. So I'm looking for a package that do that or the solution how to manually pick file and get the file path like I could do natively. Thank you in advance.
It's not impossible with native code. It's just package publisher who made it unavailable using it. Follow this to implement file path picker on native code. It works for me.
My app already uses a webview to display a website. I have all that working fine. One problem I do have is that the URL I want to use is actually hard coded into my project. I want the project to read all of the listed URL's in the .txt file and for each of them open them in the Safari View Controller(SVC). Like I said before, I have the app working, even the SVC, just with hard coded URL's in there. I would like it to be able to just know if the URL I clicked on is in the .txt file to open it in SVC not the webview. I saw some examples on how to read files, but nothing that incorporated a webview or SVC.
I've taken on the webmaster role for a website that uses DNN version 07.02.02. Most of the links to my pdf files are broken. They pdfs were in a folder called "/pdfs" now they're in a new folder "/docs/pdfs "
A few quick things:
I only have ftp access to the web site files. No access to web.config so rewrite rules are out.
I don't want to copy the old files back to "/pdfs" because it would mean managing two different pdf copies (there are over 500 pdfs).
Using file directories with a .pdf extension then add an index.asp file with a redirect i.e. "/pdfs/file_1001.pdf/index.asp" led to an error page because there's an override which doesn't allow site directory pages exposed.
Using a DNN module where I'd have to enter 500 files to redirect seems redundant when I only want to move a directory.
Any solutions to try?
In DNN if you have HOST level access you can modify Config files through the Host/Configuration manager page.
There you could modify the web.config file.
You might also look at the siteurls.config file (also accessible there) in which you could define some URL rules, might be as easy as
<RewriterRule>
<LookFor>/pdf/(.*)</LookFor>
<SendTo>/docs/pdf/$1</SendTo>
</RewriterRule>
The above rule is completely untested, not positive if it will do what you need or not.
I did a little more testing, and it looks like this won't work out of the box as a default setting that tells it to NOT rewrite PDF files, but I can't find the source code for that currently.
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.
I am using filepicker.io and specially computer as main service.
I would like to get the original file path of a file uploaded through the API.
For example, if I upload a file located at /my/path/in/my/computer/file.zip, I will get in the FPFile object the filepicker.io URL but not the original file path.
Is there a way to get it ?
PS: I have tried to retrieve the stat of the file too without success.
Due to browser security limitations, the real local path of the file is never exposed to the javascript application. For more information, see http://davidwalsh.name/fakepath