Are data URI links permanent? - javascript

So in this website I am making, the user is able to upload an image and then preview that image all on the same page.
If I right click the image that is being previewed (as a thumbnail) and click on "View Image", it will open the image in a new tab with this super long data URI.
I was wondering, are data URI's permanent (as long as the website doesn't get deleted or something)?
If I upload an image on my website, get a data URI, and don't ever delete the website, then would the data URI still be valid a year later, from any device (that can connect to the internet and access a browser) anywhere in the world? Would I still be able to view that same photo I uploaded a year ago?

Related

JavaScript: Save PDF in the 'Microsoft PDF reader'

my web app opens a PDF inside an Iframe. Users can then add texts, draw with digital ink and highlight text. As the PDF is rendered using the user's browser-engine, I recommend trying it with the latest Microsoft Edge.
I would like to save the edited PDF to the location I opened it from with the click of a button.
The PDF editor of the browser has a save feature, but users have to select the location first, and confirm that they are overwriting the file.
Is it even possible because Microsoft Edge seems to isolate the PDF process. When I open a PDF in Edge without my web app, I can simply click the save button, and it will be saved at the location I opened it.
I could not find any documentation for microsoft pdf editor and how to interact with it.
Full code of my project: https://github.com/joseftogo/PDF-Notes-Manager-Alpha
Thank you!
I agree with KJ's opinion. When you open a pdf on a website in Edge, you're actually view it online. So it's wrong to say "save the edited PDF to the location I opened it", it's not opened from local file path. If you want to save it, you're not overwriting any file on your computer, you're downloading a new file to your computer, so you have to select the location first. It's the necessary process.
For the situation you say, "When I open a PDF in Edge without my web app, I can simply click the save button, and it will be saved at the location I opened it." I think that's when you open a local pdf file in Edge. At that time, Edge is just a viewer, and the pdf is already existed on your computer so of course you can overwrite that file directly.

I want to display PDF inside div, object or iframe BUT restrict user from downloading it

I have multiple pdfs. I want to display them on my page but I don't want the user to download them. I tried using google docs but the user can open the PDFs externally and was able to download them. Any ideas?
If the browser can display the PDF file, the user can download it... or grab it from the cache... or find the direct URL from the HTML source... etc.
If your concern is the PDF getting out of your control and unauthorized users getting access to it, you're better off using a PDF DRM solution. There are various solutions at different price points.

How to make a web extension that "Inspects Element" in a webpage and does the steps as mentioned below

What it must do is whenever the user likes a picture on Instagram, it must find the link to that picture (which can be found in Inspect Element)and then save it in the computer. All this must not be visible to the user. It should just save the photo to the computer as soon as the user "likes" the photo.
Sorry I am new to the field of programming so pardon my vagueness. All helps would be appreciated. Thanks!
If I am interpreting your question correctly, you want to download an image from Instagram on clicking a link/button.
Unfortunately there doesn't seem to be a way to do this because Javascript cannot save to a users computer. A potential would be to set the Content-disposition response header, and just set the window.location to the image link. However, since you want to get the image from Instagram, that's not an option.
References:
File download script doesn't work when called from Ajax
http://www.boutell.com/newfaq/creating/forcedownload.html

How to upload the files programmatically in fine uploader?

I was able to use fine uploader successfully and it works like charm. But iam not able to figure out one of my requirement.
My requirement :-
I have information of file(file name, fie url, file size) in javascript object .I want to prepopulate the fineuploader container with the file information (basically when my page loads i want to just prepopulate(display) the files info under fine uploader container. Also i want to display delete icon so that clicking it call goes to my action class). Thats it.
I do not want any upload button just display the file info i have in javascript object under fineuploader
It sounds like you want to construct your own File object given the URL of a resource. You can't do that. Fine Uploader allows your users to upload files from their file system to your server. You can enable the "paste to upload" feature (Chrome only) that allows users to copy an image from another site and paste it into Fine Uploader, where the image will be uploaded to your server. If you want to allow your users to submit a resource given a URL, just send that URL to your server and download it server-side.

Upload Image Files Temporarily on Client Before Uploading to Server

I am working on a project somewhat similar to Wix. Here users can create new pages and then add different elements to those pages. In Phase 1 we are working on 4 elements.
Text
Link
Panels
Image
All the changes that user makes to these elements are stored in an HTML5 storage if available (else we use cookies). These changes are only updated to db once the user clicks on Save button.
Now I want to give user the live updates on the viewer of the changes that it makes. So when a user gives an image path(local-directory/Url), I want to show him that image in <img> tag in the viewer. But I don't want to upload the file to server yet. Is there any way that I can upload the file in HTML5 storage and use it to show image? My colleague suggested that I create a temp directory on user's system and keep the files there. I want to avoid this because if the user exits the project improperly I will not be able to remove my temp folder. So any suggestions or tutorials would be nice.
Regards: Jehanzeb Malik

Categories