Google Drive initiate download of a public file on your website - embed

I have found ways to embed a public folder from Google Drive on my website. This is done like this:
<iframe src="https://drive.google.com/embeddedfolderview?id=FOLDERID#list"></iframe>
You can also link directly to a public file like this:
http://drive.google.com/uc?export=view&id=FILEID
The Google Drive embedded view shows the list of files in that public folder. Clicking on the file you are redirected to Google Drive file preview page, from where you can download then file. I would like to skip this step and allow visitors to my page to click on a file and initiate this download immediately. Is this possible?

Go to where your file is located on Google Drive click on File - top left corner.
Then "right click" on the option named -Download- this will give you the direct link to your file so that you can use it as the download link.

Related

Trying to open a preexisting file so that it can be seen on google chrome

I am trying to see how my code will be displayed on a browser, but I do not know how to access it in Google Chrome.
I am trying to get something like this:
Right click the file and select, Open with google chrome.
Or you can paste the file path in address bar of chrome. Since it index.html you wont need file name at the end of file path, else the file path should end with file name.

googledrive html file only preview code

I am new to html5 and am currently working with the example on the web page listed below:
http://www.mobilehtml5.com/post/371921120/tutorial-your-first-mobile-html5-app-the-basics
To host the html page, I chose to use Google Drive as I already use it for other documents. To set it up, I followed the instructions on this page:
https://support.google.com/drive/answer/2881970?hl=en
I created a new folder under my google drive called 'New Folder' and set the permissions to 'Public on the web'. I created a file called 'index.html' on my local hard drive and put the example html code into it, then uploaded that file into my google drive under 'New Folder'.
The problem:
The page # support.google.com says that to view the html page, one must click on 'preview'. However, when I do that, all I get to see is my code, not the rendered page. Also, the google support page says there is a URL like googledrive.com/host/... but my URL is different. When I click on my index.html file it shows the code and the URL is https://drive.google.com/?tab=wo&authuser=0#folders/....
Please help. I found the google support page very high level.
Cheers
1) Go to your "Public on the web folder"
2) The url should look something like: drive.google.com/?tab=mo&authuser=0#folders/xx_xxxxxxxxxxxxxxxxxxxxxxxxx
3) Instead of the "xx_xxxxxxxxxxxxxxxxxxxxxxxxx" you should have a folder ID (it'll be random letters and numbers)
4) Replace the "xx_xxxxxxxxxxxxxxxxxxxxxxxxx" in the following link with the folder ID from step 3)
googledrive.com/host/xx_xxxxxxxxxxxxxxxxxxxxxxxxx/myHTMLFile.html
5) There's one last step. Replace the "myHTMLFile.html" at the end of this step with the name of your html file name.
See more in picture
https://www.facebook.com/posteryucom/photos/a.503819206368192.1073741827.124941240922659/704847832931994/?type=3&theater
https://www.facebook.com/posteryucom/photos/a.503819206368192.1073741827.124941240922659/704843842932393/?type=3&theater

Use html hyperlinks to index file folders

I am trying to index the file folders on my local computer using a html file. I set hyperlinks to the folders, when click the link, the internet browser (firefox in my case) lists the files contained in the folder. However, is it possible to open the file browser (linux) when click the link, rather than listing the files within the internet browser?
I do not believe this is possible because HTML controls web objects and wouldn't be able to open and search a path in a file browser. For that has to do with the physical computers file system not the internet.
If you need to me explain more just let me know

Link to open PDF from folder

I have some PDF's sitting in a folder on my computer, is there a way to write a link to open them on to a webpage?
The main idea is when the site goes live the link will be used to download the pdfs from the folder, but obviously at a later stage the folder will be a temp folder on my website.
So at the moment i just want to open the pdfs from a link, and the final goal will be to have the links download them.
Can any one help me?
This is the file path to get to the pdf i want to link to.
C:\Users\Shaun\Documents\FormValue\CS1.pdf
How would i create the link?
If you want to have a link to a PDF, you just have to put the relative path to the file in the href attribute of an a tag. So let's say you had a folder called pdfs, with the file boom.pdf inside it, and folder called site sitting beside it, with the file site.html in it. Then all you'd have to do is put this link in the html file:
Link to a pdf
In most (all?) browsers now a days, that will open the PDF in a new tab. To download it you would right-click it and do the Save Link As thing. Just need to get the path in href right.
UPDATE
If you want to use the full path to the file, you need to prefix it with file://. Then you just put it in the href the same as with a regular link, ending up with something like:
Link to a pdf
This should work with your set up, but if the pdf and the html files are stored near each other, relative URLs are still a good option. A little bit of Google work should show you how to write those.
For each PDF just do what I talk about here.
<object height="950" data="sample-report.pdf" type="application/pdf" width="860">
<p>It appears you don't have a PDF plugin for this browser.
No biggie... you can <a href="sample-report.pdf">click here to
download the PDF file.</a>
</p>
</object>
It works with most browsers and it degrades nicely.
It sounds like youre asking if you can put a link on a web site to a PDF sitting on your computer. You can't. The files have to be either on another web site or on your site's server.
If you are using ASP.NET, you can have the link point to a handler that accepts a query string identifying the file, either by file name or a hash of the file. Then the handler can look in the folder for a file that matches the pattern, read the file as a byte array, and then write those bytes to HttpResponse.

Opening a Local PDF file in Browser using JSP

I have tried to open a PDF file from the local disk.
For example the Location is:
E:/files/IT/cat1/cat1Notification.pdf
But during runtime the link changes to:
http://localhost:8080/Office_Automation/E:/files/IT/cat1/cat1Notification.pdf
How to do i get rid of http://localhost:8080/Office_Automation/ from the link and open the file?
I have used
click here
To open the local file you need to use the file scheme in your URL
As you path is a Windows path E:/files/IT/cat1/cat1Notification.pdf, the link's href needs file:/// added before the your jsp's <%=path%> variable, so that the browser knows it needs to open a local file on the user's machine.
So your link should look like this
click here
Which in your browser will resolve to file:///E:/files/IT/cat1/cat1Notification.pdf
Without the file scheme the browser assumes that your link is relative to the webpage and tries to resolve the link by making a request to your webapp. This is why you were getting http://localhost:8080/Office_Automation/E:/files/IT/cat1/cat1Notification.pdf