google drive hosting changes in URL - google-drive-api

I've developed a web app that uses google drive as hosting platform as explained here:
https://support.google.com/drive/answer/2881970?hl=en
The application has been working OK when users accessed:
https://googledrive.com/host/0B0YWdwxH6K5XdVpaNjhWUl9vZkE/?scriptid=AKfycbx66sZMaqLK8byhV7wY_DoQ8ouqF1acWRcc0JIHyDu5CVWZupAK&id=people
But yesterday it started redirecting that address to:
b216bdb4cf56e8d9d85cf1123921ca125a010325.googledrive.com/host/0B0YWdwxH6K5XdVpaNjhWUl9vZkE/
any idea why? is this a permanent change? does the subdomain key follow any logic?
Browser: occurs on chrome & IE
Operating System: windows8
Drive on the Web / Drive for desktop: when accessing googledrive.com/host

I found the right thread at google.com to answer this. Here it is: https://productforums.google.com/forum/#!category-topic/drive/mTyJXruRhBg
In short, the redirect and prefix is here to stay. It's for some security thing. All files within the same googledrive folder will be prefixed with the same guid-looking string. That is, provided we use this googledrive url form: googledrive.com/host/{folderID}/FriendlyFilename. Then, any support files you want to access or link from that folder, just access them as FriendlyFilename with relative url form.
My problem was, I was using the obscure form googledrive.com/host/{userID+fileID}. (no FolderID or FriendlyFilename). That now gets a different domain prefix for every file within the same folder.
Here's a different variation of that test file I showed above (which was getting Security exception for webworker). It works now by using the {FolderID}/FriendlyFilename form. Tada. https://googledrive.com/host/0B8BLd2qPPV7XME1rNU9iWnYtbTg/ded-worker-F12throw.html

Related

Angular 2 app - link to local file

In my app I'm viewing a list of files on the local machine (their paths are fetched from DB). When a file is being clicked, it should be opened. I tried the following with no success:
FileName
When the user clicks the link above, nothing happens. When using chrome, I can see the following error message in the console (on firefox there's no message):
not allowed to load local resource
I have read this question, and understood that:
Mozilla browsers refuse to follow file URLs on a page that it has fetched with the HTTP protocol.
I also understood and that this feature was implemented in other browsers as well.
The presented files are not located in the server, but on the local machine. So I can't use a relative link (right?). Is there anyway to bypass this and create a link that opens a local file?
You cannot access local resources from a website served over http because it is a security concern. Think of what would happen to your machine if any website could access files on it. You'll have other security restrictions for serving data from a different domain from your domain as well.
What exactly are you trying to accomplish by accessing a local file? Giving additional insight into the reason might get you more useful suggestions. Otherwise, the answer is that you can't and shouldn't do this.

Using File:/// Protocol Links with Javascript API for Office

Background
I'm writing an excel app using the Javascript API for Office. (Office 2013). Inside that app, I have several links to folders on my computer/server, which I want to access from the app using the file protocol.
I've tested the file protocol with a dummy HTML file, using this link:
C:\Users\User\Desktop
It works perfectly, opening up the Desktop folder. I've also tested using a networked drive, and it works as well.
Problem
When I add this dummy link into an HTML page in my Excel web app, clicking on it does nothing. When I right click -> Open, IE11 opens a new instance (which doesn't happen with mailto: links), and asks if I'd like to give permission. After I do give permission, the folder is opened.
Goal
I want a single left click to open the folder location without the permissions box ever popping up. Worst case, I want to be able to have the user open a dummy link once during app setup and then once permission is given avoid having to right click -> open.
Question
How can I accomplish the goal here? Is Office just locking down the links?
Update
The primary issue I've found out is that the site I'm hosting the app on wasn't a trusted site. Links using the file protocol only work on intranet and trusted sites. So the only question now is whether the Office store location is trusted.
The problem here lies in the way that Office Apps work. A manifest file is stored with the Office Store, and that is what users download. That manifest points to a server location that the app developer specifies, and that is the location from which the app is served. That is the location which must be added to Trusted Sites in IE.
Therefore to get the File Protocol working smoothly, I'd need to include instructions with my App on adding my hosting server to the Trusted Sites domain, and I'd have to avoid ever changing domains.

Sharing Google Drive Realtime Documents

I have created a realtime document on Google Drive. When I attempt to share this file with someone who doesn't have my app installed, the file shares successfully, but when they click the file it says "Sorry, no preview is available".
This realtime document is a shortcut file. How do I get it to prompt the person to authorize my app?
I'm using the Realtime Playground as my example as I'm not sure of the specifics of your application.
App authorisation
When you created your application you visited the Google API Console and created a project with Drive API enabled. At some point you copied "Client ID" from the Google API Console into you application ID code.
In the realtime-playground case APP_ID is set in the javascript file rtpg.js (you might not be using JavaScript but there will be an equivalent step for other languages).
rtpg.APP_ID = '840867953062';
File creation
I believe that any drive realtime document/shortcut you created with your application will contain a reference to the creating application (mostly likely in the form of the client/application ID you obtained above).
File sharing
Once you can see your newly created Google Drive Realtime document/shortcut you can share this with somebody else using the normal Google Drive sharing methods. At this point they can see it but cannot do anything apparently useful with it. This is where I believe your application may differ from the realtime-playground example.
Integration with Chrome Web Store
On the GitHub repository for realtime-playground you'll notice a cws (Chrome Web Store) directory containing the stuff necessary to deploy the realtime-playground as Google Drive application in the Chrome Store including screenshots to be used. If you look at the manifest.json file you will see another reference to the client id:
"api_console_project_id" : "840867953062"
So if I share a realtime-playground file with somebody who doesn't have it installed, then clicking on the file in Google Drive will result in a "Connect app" popup which will try to locate the corresponding Chrome Web Store Drive app (using the common id as the key) and this will show something similar to what you might see if you found this application directly in the Chrome Web Store.
The manifest.json also contains:
"app" : { "launch" : {
"web_url" : "https://realtimeplayground.appspot.com/" } }
which tells Google Drive what to do when the installed app is called.
So my guess is that your application doesn't work like this as you don't yet have public visibility of your app in the Chrome Web Store.
See also: Create a Chrome Web Store Listing
I hope this helps.
That is fine. If you open your eyes, you will notice that Playground demo does not provide any preview either
Yet, you see, the associated app is available. You can click it and open-with works normally. Your app-created files operate similarly. They are associated with your app by default. You can open them by open with rather than by preview. Can you? No, you cannot. But that is another question.
Otherwise, I see no cleverness in associating your file with chrome extension rather than with your app.
How do I get it to prompt the person to authorize my app?
I recently had a similar question. Instead of linking your files with extension in chrome, pass the direct link, like http://your-app#fileId=..., as playground demonstrates to your shared fellow if open-with fails.
The preview seems to be another story.
Wait, Do you mean that I need to create a new fresh account to test how your file is unassociated with your app? How do you preview the files in your primary account? If you know how to preview you may answer my question, at least partially. But why do you associate authorization with preview?

Given URL is not allowed by the Application configuration. when using the Facebook Javascript SDK

Im currently using the Facebook Javascript SDK and I keep running into the following problem that appears in the console:
Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
I've read a truck load of related posts but still can't get it to work. I am working locally using the following: http://localhost:8080/bookbayapp/. In my facebook developers app section I have the following:
But once again nothing seems to work. I am currently using Google Chrome for the testing and it is worth to mention that I am using the Facebook Plugin for Phonegap but when testing I comment out the link the to plugin js so I assume in doing this there shouldn't be any problems?
What works for me is using the actual URL of the production server, and then adding a line to the hosts file that redirects all traffic from that URL to localhost.
Let's say your website is called potatoes.com. In "Site URL" write:
http://potatoes.com/bookbayapp
and then open your hosts file (C:\Windows\System32\drivers\etc\hosts) and add the following line:
potatoes.com 127.0.0.1

Open a shared folder on a domain from a web page

Thanks for you help in advance,
I am building a very simple web page , (a single page) with links to e.g bbc.com, cnn.com etc, (this works fine)
now i need to create diff links on that page to various location on our internal shared drive, which is already map to user pc from the server (running win server 2008).
wen users who's systems are not connected to our domain try to access the shared drive (after a shut down) they are always prompted for username and password which then give them access to the drive.
my ques now is how do i create this link on my html page so that when users click it. its opens (\10.10.0.1\k\Shared\HR) in windows explorer and not in the browser which it does now.
<li data-tags="Logo Design"><img src="images/portfolio/thumbs/image(5).jpg" alt="Illustration" />
this is the line i use.
i have read this links but they dont look to ans my ques, or i dont just understand what to do,
Opening windows explorer via link
Open ClickOnce application deployed in shared folder by a web browser
Access a shared folder from a machine not in the domain
https://stackoverflow.com/questions/7249017/open-file-w-test-in-explorer-exe-not-in-chrome-or-internet-explorer-any (this looks like what i need but i don't know where to fit in the code there)
How to launch an EXE from Web page (asp.net)
am doing this on my system but will transfer it to the server, and will place a shortcut to my index file on users desktop.
Thanks for you help, I hope I have provide all the info needed to help me with this.
we all use chrome cause of google drive
This will not be accomplished by any default browser configuration that I am aware of, as using file:// references would typically cause the browser to try to launch the file. Maybe search though Chrome plug-ins to see if something is available there to override default browser behavior.