How can I manage websites settings in electron - javascript

I'm creating a browser using Electron. And it opens websites using webview.
<webview id="View" useragent="..." src="https://example.com/" plugins="" preload="file/dir/webview.js" webpreferences="..." enableremotemodule="false" allowpopups=""></webview>
Now I've got a question, how can I detect when a website is trying to request access to something using JS/Node?
The explanation of my question:
Every website in chrome has its own settings, and they can be access by clicking Site settings in the page info window (look up in the picture) or by going to chrome://settings/content/siteDetails.
And the website settings include whether it can or can't access the user location, use the microphone, use JavaScript, Senf Notifications, etc.
How can I control those settings of websites in electron?
And how can I detect when a website is trying to gain access to one of those permissions? (just like how Wexond does, Wexond is a browser that is built using Electron)

Related

Way To Inject Javascript in PWA on Non-PWA Pages?

If I make a Progressive Web App (PWA), and I change the display in the manifest.json file to browser instead of the typical standalone preference people usually choose for PWAs, and the user opens the app and surfs to some third-party site outside my control, such as Reddit.com, does this app still have control such as the ability to add Javascript and CSS into the page kind of like a Chrome Extension would?
display: "browser" does not give you a stand-alone application. It opens in a normal browser tab/window
I'm not sure of any browser that will actually let that be installable, either.
That doesn't pass installability criteria for Chrome, for instance
As for being able to inject CSS and JS into other pages, no, you can't do that, with any display mode. It's just a website in a fancy display. PWAs aren't web views like in mobile apps, and the browser still owns the overall display context (rendering, extensions, etc…), not the installed app

How does Zoom launch their desktop app from Google Chrome?

How does Zoom's website launch Zoom Meetings from Google Chrome?
Can I do it using JavaScript? If so, how can I do it?
Confirmation dialog box (Image)
It's not done with JavaScript, but with plain HTML. The way it works is, you create an <a> with an href attribute with a protocol other than the ones a browser usually recognizes - that is, other than http, https, etc.
If the user has installed an application that recognizes the protocol, the browser will try to open that application.
Similarly to Zoom, for IRC links, you can see something like:
Link
If you click on that link, and your machine has software installed that recognizes the irc protocol, that application can be opened directly by clicking on the link (possibly asking you if you want to open it first).
There are lots of different protocols for many different applications. They're quite handy for getting info on a web browser to an application on the user's computer.
For Zoom in particular, there's documentation on how to use its protocols here:
https://marketplace.zoom.us/docs/guides/guides/client-url-schemes
Making a link with a protocol registered to the zoom app on the operating system.

Making an iframe inherit cookies from the parent in Safari

My web app extends a Google Form's functionality by loading it as an iframe, and doing other stuff outside the iframe. If the Google Form requires authentication, Google makes a "Sign In" box appears within the iframe. When a user clicks on the button, a new tab opens, and the user is re-directed to the form in the new tab.
If a user navigates away from my web app, the extra functionality will obviously not work. So, what I am looking for is: to have an authenticated Google Form load as an iframe within my web app.
I can make the user first sign in via Google Sign-In (OAuth) on my web app and then load the iframe. On Chrome and Firefox, the iframe automatically starts with a logged-in session. This is great! But, this solution doesn't work on Safari. Is this related to Safari blocking third-party cookies?
If I want this functionality to work within Safari (and other such browsers), how would I go about doing it? Will I have to use the Storage Access API? If yes, can you broadly tell me how to do it?
For now, I could just ask users to download Firefox/Chrome if they want to use my web app. Most of my users are Chrome users anyway. But, is implementing these privacy measures a part of other browsers' roadmap too? If yes, I may as well try and build a solution that will work in a year or two.
I expect so.
This needs to happen in the iFrame, so Google rather than you need to implement it.
Yes, but not until 2022, so I would hope Google forms will support this by then.

How does soundcloud web make an android notification

I am talking about this notification:
Somehow SoundCloud (the website) makes this notification appear and it has working controls. I do not have the app installed, that notification originates from com.android.chrome. I don't really need to know this to reproduce it, but I'm curious as to how it accomplishes this and perhaps in what other ways you can use it.
This is accomplished with Chrome Media Notifications. https://developers.google.com/web/updates/2015/07/media-notifications
To get the playback controls, and other information on the notification, you can customise them by providing meta data with the Media Session API. https://developers.google.com/web/updates/2017/02/media-session
When Android is programmed, it gets certain features that allow it to communicate with web hosts and websites. The website will have to be built a certain way that allows it to be communicative, but that seems to be what's happening in this situation.

Looking for a script that can be ran in Chrome to automatically reset the browser settings.

What I'm looking to do is create a script that we could place on people's desktop to reset some settings back to where I want them for internal web application?
The script will need to reset everytime a user opens and closes the browser.
As far as my knowledge says, you cannot just edit settings of a browser without attaining user's permissions. So, it will be better to write a chrome plug-in application and ask you web application users to install that first.
You can identify the plug-in status in your web application.

Categories

Resources