$type=carousel$cols=3$show=home$cate=0$count=9

Danh mục các chủ đề

network (36) facts (35) Windows (22) Excel (20) email marketing (19) LINUX (14) MOS (8) QTVP (7) WordPress (7) Software (6) hitech (6) word (6) CISCO (5) PowerPoint (5) phone (5) Vien Dong (3) WIFI (2) cá cược thể thao (1)

Publish Website Content

Publish Website Content Get Started   Documentation   Examples   Support   Blog GDG   Live Google Drive lets you publish a directory as a we...

Publish Website Content







Google Drive lets you publish a directory as a website. You can insert static web assets such as HTML, CSS, and image files in a publicly shared folder, and then serve those files directly to users via file names in a relative path. Drive supports JavaScript and other client-side scripting languages, so it's even possible to run a JavaScript Drive app directly from Drive.


The requirements to publish are:
  • The folder containing site assets must be public, or "Public on the web." Assets added to public folders must also be public on the web.
  • Link to the files contained in the folder using the webViewLink folder ID plus the path to the file.

Creating a public folder

To create a public folder programmatically, you'll need to insert a "file" of the MIME type application/vnd.google-apps.folder (a type reserved for folders in Drive) and then set the appropriate permissions. The account type must be set to anyone, and the role must be reader.








The following samples demonstrate how to create a public folder using the supported client libraries.





function createPublicFolder(folderName) {
 
var body = {
   
'title': folderName,
   
'mimeType': "application/vnd.google-apps.folder"
 
};

 
var request = gapi.client.drive.files.insert({
   
'resource': body
 
});

  request
.execute(function(resp) {
    console
.log('Folder ID: ' + resp.id);
   
var permissionBody = {
     
'value': '',
     
'type': 'anyone',
     
'role': 'reader'
   
};
   
var permissionRequest = gapi.client.drive.permissions.insert({
     
'fileId': resp.id,
     
'resource': permissionBody
   
});
    permissionRequest
.execute(function(resp) { });
 
});
}
The key to Drive's built-in site publishing is the webViewLink provided in the files resource. When you insert a public folder using files.insert, the response contains a webViewLink entry that looks something like this:
 "webViewLink": "https://googledrive.com/host/A1B2C3D4E5F6G7H8J9"






Once it has this URL, your app can use it to provide a link to contents in the folder. For example, a link to kittens.jpg in an images subfolder could be
 https://googledrive.com/host/A1B2C3D4E5F6G7H8J9/images/kittens.jpg
You can access the hierarchy of web assets in the folder using file names and relative paths instead of fileId values. If you provided a link to anindex.html file in the folder that contains an image link for kittens.jpg, then the page displays the image within the page as expected. If you link directly to a folder that lacks a valid index.html file, Drive displays a simple list of the folder's contents.

Extending basic site publishing

The ability to link to files this way opens lots of possibilities for Drive app developers. Writing a blogging tool, creating a process to publish updates to shared docs, outputting images in a folder in a gallery page — any Drive use case that involves presenting a file in a browser can benefit from site publishing. For a larger-scale project, consider the potential to create a site-building IDE for Drive users.

COMMENTS

Tên

cá cược thể thao,1,CISCO,5,email marketing,19,Excel,20,facts,35,hitech,6,LINUX,14,MOS,8,network,36,phone,5,PowerPoint,5,QTVP,7,Software,6,Vien Dong,3,WIFI,2,Windows,22,word,6,WordPress,7,
ltr
item
Tin học ứng dụng: Publish Website Content
Publish Website Content
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi588Yfv4YA-q1OGiDOm5Yaf6zj2Bs1KdfYT_3obkQqUCQ7f3dRIU96pEn7xEm8TyPofpebV9dYcfE4jrDGJCCvtr0ItT3RokeGD_V51T96VBlrGsTcdtdbP_6jZiyhoprsmRFszakZ59Cw/s1600/WWW.jpg
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi588Yfv4YA-q1OGiDOm5Yaf6zj2Bs1KdfYT_3obkQqUCQ7f3dRIU96pEn7xEm8TyPofpebV9dYcfE4jrDGJCCvtr0ItT3RokeGD_V51T96VBlrGsTcdtdbP_6jZiyhoprsmRFszakZ59Cw/s72-c/WWW.jpg
Tin học ứng dụng
https://tinhocungdunginfo.blogspot.com/2014/08/publish-website-content.html
https://tinhocungdunginfo.blogspot.com/
http://tinhocungdunginfo.blogspot.com/
http://tinhocungdunginfo.blogspot.com/2014/08/publish-website-content.html
true
7970184340113489634
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy