We surf the web for a million different reasons – for everything from school research projects to time-killing memes. And when we find something relevant for us, whether that be our most recent pay stub or just an adorably awesome pic, we may want to save it for later reference or to share with friends in the future.
Starting today, Drive users can use the "Save to Drive" button to do exactly that. The “Save to Drive” button is an easier way to save files directly from a website. If you have your own website, you can improve the experience for your site visitors by adding the “Save to Drive” button to your page using two easy lines of HTML.
Saving an ebook to Google Drive from the O’Reilly website |
Just try it out. Save this cute kitten’s image to Google Drive using the button below:
Credit: Krzysztof P. Jasiutowicz |
Adding a Save to Drive button on your website is easy. You simply have to include the script and HTML tag below:
<script src="https://apis.google.com/js/plusone.js"></script>You can also use the Save to Drive button’s JavaScript API, which allows programmatic and flexible control of the creation of Save to Drive buttons in your web pages.
<div class="g-savetodrive"
data-filename="My Statement.pdf"
data-sitename="My Company Name"
data-src="/path/to/myfile.pdf">
</div>
The Save to Drive button works in the context of the user’s browser. This allows your users to save files that could require some form of HTTP authorization – such as a session cookie – without any special customization from you. In most cases, the Save to Drive button should be simple to integrate, plug-and-play!
Check out some companies that have already added Save to Drive buttons on their sites: Bigstock, Delta Dental, Fotolia, O'Reilly, Outbox, Ultimate Software, and Zen Payroll.
Saving a dental statement from Delta Dental |
Saving your physical mail to Drive from your Outbox account |
To learn more, have a look at our technical documentation, and if you have questions, don’t hesitate to post on Stack Overflow.
Nicolas Garnier joined Google’s Developer Relations in 2008 and lives in Zurich. He is a Developer Advocate for Google Drive and Google Apps. Nicolas is also the lead engineer for the OAuth 2.0 Playground.
Posted by Scott Knaster, Editor
No comments:
Post a Comment