I want my react app to be able to download (for example) PDF files. But these PDF files should only be downloaded through my react app. If I google around for downloading files with react native all I get is stuff like react-native-fetch-blob and the request looks like this:
.fetch('GET', 'http://www.example.com/file/example.pdf', {
(The example above is part of a bigger piece of code.)
Now if you would visit http://www.example.com/file/example.pdf in your browser you will see the PDF file but I don't want that. I want to make it so that the PDF file can only be downloaded through the app and nowhere else.
How would I go about making a system like this?
Thanks in advance for helping!
Related
I can import a file with a .PRNx extension
But I would like to detect changes in the content of the file in order to update the map.
A lot of sites tell me to use fs.watch but I am in javascript web development and not node.js.
Do you have any ideas?
Thanks
I am developing in R/Shiny (which mainly makes use of JavaScript) to display the results of the web applications.
In one of our application, we must create an XML file and redirect the user to an URL that has this XML file path in its URL as an argument.
Something like :
http://path.to.my.service:1234/file=u:\my\shared\myxml.xml
At the moment, we create the file "myxml.xml" in a folder that is mounted both in the user and the server file system but I found this really unpractical and ugly. I'd rather create a file in the user local file system and have the link point to it.
I'd like something like :
http://path.to.my.service:1234/file=C:\Users\moi\AppData\Local\Mozilla\Firefox\Profiles\monprofil\myxml.xml
To this of course, I need :
to be able to create an XML file in an accessible dedicated directory (e.g. the browser cache dir)
to be able to have to path to it.
Do you see any way to achieve this kind of results?
Many thanks for your kind help.
Sylvain
I used react and webpack to build up a .js file like below.
5.9M ./app.8d30cc2e71548cd03a7b.js
but when it is uploaded to the server and then visit from browser. The network display like this.
the same file, why the size change a lot, amazing.
what happened in this process?
Is there a way to replace a .js file in the website sources with a file on my workstation, or make a modification to a .js file and refresh the website to see the changes?
I am developing client-side JavaScript code against a SharePoint website on a server. I cannot create a local version of the website, so I need to modify the script, save the file to the server, refresh, etc. I do not have direct access to the server, and saving a file in a SP doc library or web part takes a lot of time between edits.
I can make small modifications using the dev tools while breaking on certain lines and applying snippets, but I am hoping for a better way.
Thanks!
If you have access the server that's hosting the file you should be able to replace or modify the JS file. Alternately you can use local hosting tools to test your file and then upload it to the server once you've confirmed it's working.
If you explain what you level of access to your host is we can offer better suggestions.
I have to integrate pdf files in my PHP web application such that the viewer of the file can not save/download/print the pdf file.
I am finding a way of doing this in any way like using javascript, jquery or straight in PHP or any other way if any.
I think you'd need a custom PDF viewer in your app, like what Google Drive does with images and documents.
I'm not aware of any functionality that allows an app to tell Chrome/Firefox or the registered PDF handler to limit user interaction like you mention.