a href to chrome:// url in a chrome extension how to make it work - api

I've written a Chrome extension to use as an iframe in my own locally stored home page. I just want a way to access the basic settings, extensions, bookmarks, and so forth. I know this is denied in a standard html. I thought an api should do the trick:
onclick="chrome.tabs.create({url:'chrome://settings'});"
but to no avail. How can I access these settings?

You cannot access chrome pages from an extension. However you could get some settings with Chrome APIs
Specifically Bookmarks API, Installed extensions API

Related

How to allow direct access from browser to a `page` contained in a SPA on a chrome extension?

I have been working on a chrome extension using vue 3, vue-router and vue-x.
The extension is a Single Page Application, so if I understand correctly, it means that all incoming traffic should go through a root page and then vue-router handles the rendering while giving the user the impression that he changed page when in reality, he did not.
According to this part of vue-router documentation, you normally need something server side to make sure your root page is always served (nginx, apache, etc).
I need to reproduce this behaviour for my chrome-extension, and I have tried playing with the manifest.json but without any success so far. When I try to access to my other page, I have a File not found error. If I was to create an other-page.html, it renders but it wouldn't be a SPA anymore. I could try to put some hacky JS inside this other page but I was wondering if there was any more elegant way to handle this.
tl;dr: How to allow direct access from browser to a page contained in a SPA on a chrome extension.

Safari App Extension content script not loaded on Safari error page?

When running a Safari App Extension, if Safari shows "Failed to open page", your content script isn't loaded. In this sort of scenario, it might be nice to redirect the user to a new url or suggestions page such as "did you mean...".
Is it possible to get a Safari App Extension's content script to load when a Safari error page is showing up?
No, it does not appear to be possible.
Based on Apple's Safari App Extensions "About Permissions for Scripts and Style Sheets" documentation, I'm deducing that script injection only works on web content from http:// or https:// schemes, while error pages are loaded from local files.
A URL pattern takes the form Scheme://Domain/Path.
(...)
Scheme can be http or https. (...)
The asterisk character can be used anywhere in the domain or path, but not in the scheme.
For reference, here's the path of a Safari 13 error page template.
file:///Applications/Safari.app/Contents/Resources/en.lproj/StandardErrorPage.html

Getting error using Firebase popup authentication in Word add-in

I was already using Firebase for authentication for other (related) projects and would like to stick with it.
Using Firebase with a Word add-in seems challenging. On Windows you're stuck with IE11 and on Mac (crucial for me) the browser used to load a taskpane is webkit, not the default browser.
I can get authentication on Windows to work just fine if I use signInWithRedirect (Google and Facebook).
But this won't work on Mac. Using signInWithRedirect opens a new tab in the default browser, which doesn't share cookies/data with the webkit browser the add-in actually uses.
When I switch to signInWithPopup, I get:
There is no application set to open the URL about:invalid%23zClosurez.
On Windows I get a popup IE11 window, for a split second, and it contains about:invalid%23zClosurez for a URL.
I have appdomains called out in my add-in XML manifest:
<AppDomains>
<AppDomain>https://writeitwithme-a114a.firebaseapp.com</AppDomain>
<AppDomain>https://www.firebaseapp.com</AppDomain>
<AppDomain>https://www.googleapis.com</AppDomain>
<AppDomain>https://www.facebook.com</AppDomain>
</AppDomains>
Any help appreciated. Worst case I drop to using manual registration, via Firebase, for Mac, but seems unfortunate to have to give up.
Just documenting for anyone finding this later.
I couldn't figure out how to use Firebase social login when creating an add-in for Mac. Every authentication window opened in the default browser, not the webkit engine used by Word on Mac. Sticking with manual login worked.
IE11 is always finicky when using localhost. I test elsewhere, then push files live and then try IE11 and social + manual login (via popup) works just fine.
I found the following resources from Microsoft docs that made this easier for me:
https://learn.microsoft.com/en-us/office/dev/add-ins/develop/dialog-api-in-office-add-ins
Basically you need to make a call to open up a dialogue box:
Office
.context
.UI
.displayDialogAsync(
'https://myDomain/myDialog.html',
{height: 30, width: 20, displayInIframe: true}
);
Then you can make your own page that does a login flow and passes a message (likely a credential of some kind) back to your plugin via the messageParent method:
Office.context.ui.messageParent(googleProfile);
From there you can do the following to sign in with the credential provided in your add-in:
firebase.auth().signInWithCredential(credential)
Also, be very careful with how you construct the URL of the dialogue box. I lost hours not knowing that the _host_Info param from the origin URL would mess stuff up (I was constructing my new URL from the origin URL). Figured it out in this github issue: https://github.com/OfficeDev/office-js/issues/378

access user arbitrary folders with chrome localstorage API

I'm developing an app on Google chrome which could be able to read and write files to arbitrary folders on the user’s hard drive, such as their My Pictures or My Documents folder.
I want my app to has its one folder, like "Users/Username/App", so users could be able to access some of the data, created and edited by the app. How can I do this?
I read the book "Using the HTML5 Filesystem API", so I know it's actually not possible with HTML5 Filesystem API alone. Same thing was possible by opera 11, 12. (see: http://dev.opera.com/articles/view/file-i-o-api-for-widgets/). Chorome mediaGalleries API do same things but just for media file but I want to use html, xml and office files
It doesn't sound like you've looked at the list of Chrome App APIs. Have you? Among them is the fileSystem API, which is evolving quickly to include directory access.

Safari extension autoinstall

I want to host an extension on my own website
When user clicks a specific button on my site, extension should install automatically just like it does from Apple - Safari - Extension section https://extensions.apple.com
You cannot do that. Inline installation of extensions from 3rd party websites is not available on Safari.
You can however just download the extension yourself and open it programmatically.
Or
You can ask the user to download the extension and double click the extension from the downloads folder. However if you take this route you will need to have some UI to educate the user.