Extension calls uninstalled function in V3 automatically - javascript

Chrome extension version v3 automatically runs the chrome.runtime.setUninstallURL function. So its automatically triggers the logout.
I need the why its occur in v3 but not in v2.

Related

Cannot write to clipboard from service worker in a MV3 chrome extension

I have an existing Chrome Extension with Manifest Version V2. I'm trying to copy page url when user clicks on the extensions icon. I was relying on execCommand('copy') function to copy links before. With Manifest V3, as windows object is no longer accessible from service worker. I'm trying to migrate and use navigator.clipboard.writeText(url). When I trigger the event to copy using clipboard, I hit navigator.clipboard undefined exception.
I'm triggering the events on "https" links, which is considered a secure context.
Does anyone know why clipboard is undefined from service worker even in context of https?

Open inbuilt android google map directly with navigation using start and end address when user clicks on link withing agm

My question is similar to How to open a mobile device's map app when a user clicks on a link?.
I have a single app developed using angular 8 which runs on desktop browser, mobile browser and inside an andriod app which uses Cordova(using Android browser) based on chromium, to show the web view (the iframe).
I have used angular google map inside my angular app and I am trying to achieve something like, if user is opening my app inside a mobile browser or an andriod app(which uses cordova web view), I need to open the native/inbuilt google map for navigation for the specified source and destination when clicked on the link. And in desktop, I am opening the google map web view.
Here is my code below:
navigate(startAddress,destAddress){
if (navigator.userAgent.match(/(Android|BlackBerry|IEMobile)/) && !this.inIframe()) {
window.open(`geo:${this.latitude},${this.longitude}?q=${startAddress},${destAddress}`);
}else if ((navigator.platform.indexOf("iPhone") != -1)) {
window.open(`http://maps.apple.com/?q="${destAddress}`, '_system')
}else {
window.open(`https://www.google.com/maps/dir/?api=1&travelmode=driving&layer=traffic&origin=${startAddress}&destination=${destAddress}`);
}
}
inIframe() {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}
But I have a problem here, when I determine my app is opened in a mobile(first if statement), I am using geo:${this.latitude},${this.longitude}?q=${startAddress},${destAddress} to open the inbuilt google map navigation. The inbuilt google map gets opened but it is not showing the navigation directly with the given source and destination.
I am not sure how to use the origin and destination address geo:properly with src and dest addresses.
I have seen Android - launch google map via web url which helped me to open the inbuilt google map directly but using my approach with start and end address, the app gets freezed and does not directly show the navigation also.
Could you please verify my approach and let me know where I am going wrong?
On an Android device:
If Google Maps app for Android is installed and active, the URL launches Google Maps in the Maps app and performs the requested action.
If the Google Maps app is not installed or is disabled, the URL launches Google Maps in a browser and performs the requested action.
https://www.google.com/maps/dir/?api=1&origin=Google+Pyrmont+NSW&destination=QVB&destination_place_id=ChIJISz8NjyuEmsRFTQ9Iw7Ear8&travelmode=walking
above is the normal request that seems fine in you code tooso you could use the link implementation for android too.
apart from that you might wanna look into url encoding and construction bars :https://developers.google.com/maps/documentation/urls/url-encoding
Save yourself the hassle and use https://github.com/dpa99c/phonegap-launch-navigator which does that for you

Google Maps API issue - Browser Not Supported Error

Tested html code and Javascript which renders maps in Chrome and Firefox. When called from our application the maps will not render and we get the Browser Not Supported Error. Tested using Chrome 62 and Firefox 56.0.2. Map API Key is valid and tested. Using Devtools see no errors in the htm and javascript code.
We use a gis server to house the code that renders the maps for Google Maps, Bing and Custom GIS map servers. Application server houses a DB that has the URL for all the map connections. These URLs are used by client applications to render maps on PC, Android and iOS devices
Fixed the problem by adding the frozen version in the javascript
Now the map tiles render. Having issue with other script errors but I thinks I can fix

How to check if there is a new version of google chrome extension

I have a google chrome extension and i want to check every X minutes if there is a new version.
And if there is a new version i want to update the extension automatically.
Thanks!
Google Chrome automatically performs these checks and updates the extension automatically, every few hours. See https://developer.chrome.com/extensions/autoupdate for more info. As noted there you can also use --extensions-update-frequency command-line flag to set a more frequent interval in seconds.

Browser extensions detect install

I have one extension in Firefox and one in Chrome. I want to call a javascript function when installing or uninstalling the extension. It is possible in any of those browsers?
Firefox
Detecting installation is already covered in this answer: Firefox extension opening a page on install
Sample code to listen for uninstallation of the add-on (using the AddonManager API)
Google Chrome
In Chrome, there are no built-in methods to detect installation or uninstallation.
One can check whether a localStorage flag on the background page exists, and act on that.
if (!localStorage.getItem('my-extension-first-time')) {
// Do something
alert('Hello first timer!');
// Set flag
localStorage.setItem('my-extension-first-time', true);
}
There's no way to listen for the uninstallation of itself.
The chrome.management API can be used to monitor external extension (un)installations.

Categories