I managed to get my PWA to complete all the chrome dev tools tests but I still cannot get an install prompt to fire.
www.billtravis.net/pwa/
from what I've seen everywhere the install prompt should fire when the manifest loads before the service worker installs.
This PW also needs to live on an IIS server, which won't even register the worker.
Any ideas?
{
"name": "SYLVANIA LightPRO",
"short_name": "LightPRO",
"icons": [
{
"src": "/img/image-512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": "/pwa/?homescreen=1",
"scope": "/",
"display": "standalone",
"background_color": "#ff6600",
"theme_color": "#ffffff"
}
Probably it due to lack of image sizes definitions in manifest.json which were required by web browser. I can see you have only 512 while different browsers expect a different set of images. So if you would not like to care about that differences in PWA implementation between the browsers, you can use pwacompat:
<script async src="path/to/pwacompat.min.js"></script>
This "polyfill" will generate all necessary images (if not specified in manifest.json) and will add metatags (required by ios for example)
Related
I have created some Chrome extensions for fun but later I found some app in the chrome://apps/ tab.
I tried to open their manifest.json and find this segment:
"app": {
"launch": {
"web_url": "https://www.***.com/"
},
"urls": [ "https://www.***.com/" ]
},
But I couldn't find any related documentation online.
Is there any reference for this?
Thanks
Yes, it's here. https://developer.chrome.com/apps/about_apps
But you should carefully consider to use this because:
Important: Chrome will be removing support for Chrome Apps on Windows, Mac, and Linux.
I have a very simple chrome extension that refuses to run on some sites like https://mail.google.com. It runs fine on other sites which makes me think something is limiting extensions/scripts from running on some sites. The sample case is quite simple and listed below.
With this sample case I see "Hello world" in the developer console when I navigate to https://about.me. I also see the extension in the Developer Console's Execution Context Selector. However, when I navigate to https://mail.google.com I don't see the log entry or the extension in the Execution Context Selector.
I have tried something similar with tampermonkey and am not seeing that script run on gmail either. Thanks!
manifest.json:
{
"manifest_version": 2,
"name": "Gmail extension test",
"version": "0.1.9",
"description": "Try running inside gmail page",
"content_scripts": [{
"all_frames": true,
"js": ["content.js"],
"matches": [
"https://mail.google.com/*",
"https://about.me/*",
"http://*/*",
"https://*/*"
]
}]
}
content.js:
console.warn("Hello world");
Environment:
Chrome 66.0.3359.117
macOS 10.13.3 (17D102)
As #wOxxOm suggested. I tracked down the problem to the fact that my company has a Chrome policy set against running extensions on the google.com domain. I had no warning entries in the Developer Console or the macOS Console, I just tracked down other folks complaining about in an internal forum.
The policy that applies in this case is ExtensionSettings which is set in a OS/device specific way. To help diagnose this restriction, you can view your active polices in Chrome under chrome://policy/. In my case I had something like the following in my chrome://policy:
{
"*": {
...
"runtime_blocked_hosts": [ "*://*.google.com", ....]
},
I'm not aware of a generic workaround for this at the extension level. Instead I had to work with my company IT department to whitelist the extension.
I am having problem activating my own custom made script. It's working in the developer mode, when I load it as a directory. But when I pack it using the method provided by chrome it does not work.
It creates a .pem and .crx file, and when I drag and drop the extension inside the chrome://extensions page it shows. When pressing f5 it is deactivated every time, and when I check "also allow in incognito mode", that checkbox disappears immediately and doesn't come back.
Below my manifest file contents:
{
"manifest_version": 2,
"name": "Test script",
"version": "0.1",
"incognito": "split",
"content_scripts": [
{
"matches": [
"http://mail.google.com/*",
"https://mail.google.com/*",
"https://accounts.google.com/*"
],
"js": [
"jquery-2.1.4.min.js",
"content.js"
]
}
]
}
Any clue what's happening?
Chrome blocks extension installs on Windows unless they come from Chrome Web Store.
Install Chrome from a developer channel or use another OS.
I want to distribute a PNaCl app, inline installation and use the app without leaving the current page. I have published the app on CWS. The app needs some user permissions. Inline installation works and the app appears in the Chrome browser apps section. But, I get this error :
"NaCl module load failed: could not load manifest url"
when I try to load the app using:
<embed id="testapp"
width=0 height=0
src="testapp.nmf"
type="application/x-pnacl" />
This is the testapp.nmf file which is located in the .zip pkg that I uploaded to developers dashboard.
{
"program": {
"portable": {
"pnacl-translate": {
"url": "testapp.pexe"
},
"pnacl-debug": {
"url": "testapp_unstripped.bc"
}
}
}
}
Manifest.json in the package file looks like :
{
"name": "testapp",
"version": "0.0.0.2",
"manifest_version": 2,
"description": "TCP/UDP test",
"offline_enabled": true,
"icons": {
"128": "icon128.png"
},
"app": {
"background": {
"scripts": ["background.js"]
}
},
"permissions": [
{
"socket": [
"tcp-listen:*:*",
"tcp-connect",
"resolve-host",
"udp-bind:*:*",
"udp-send-to:*:*"
]
}
]
}
The HTML page is on Google's blogspot.com and verified successfully.
Observations:
You can't use socket APIs outside a packaged app (since there is no way to get permissions for them otherwise).
A packaged app is mostly self-contained: it's not something interacting with the normal browser, it's a preset collection of resources that is displayed in a separate window.
A certain website can still communicate with the app.
Seems like you're trying to follow two guides at once, for a packaged app and a web app. PNaCl can work in the context of a web app by just placing the pexe and the manifest on the site itself; but you require raw network access, and it can only be requested in a packaged app.
You can absolutely use inline install to add the app to the user's machine, but you can't embed a module from it in a normal page.
Your module can only be embedded in the app's own pages. So if you wanted to show some UI, you need to make that a page packaged together with the app and show it with chrome.app.window.create.
If you absolutely need to expose functionality to a certain website, you can list it in externally_connectable and use messaging API to communicate with the app's background page.
An app always has an event page, that is a page that unloads if it's idle. So if you just embed your module in that page by dynamically creating an <embed> element, it may fail. However, if you're using the externally_connectable method, you should be able to keep a port open, that would cause the page to keep running.
Okay, this is weird.
This is my extension, and it works flawlessly in Windows (atleast on two win7 machines), but when I tested it on linux (CentOS6 and Fedora18) it failed to do anything when its icon was clicked (it should, at the very least, display an alert).
The options page still works, and saves data properly.
After enabling developer mode in chrome://extensions/ you can click _generated_background_page.html for the extension to see the JS console for the addon.
That's where I saw the following error:
Error during tabs.executeScript: Cannot access contents of url "https://www.google.com.au/". Extension manifest must request permission to access this host.
actual url in error is not relevant, does it to all sites
Thing is, the windows machines showed no such error, shouldn't this be platform independent?
The manifests are obviously the same, so how come the addon hasn't the required permissions only on linux machines?
Mac is untested, if someone could try that for me, it might be useful
FURTHER INFORMATION
The error message above was given with the following information;
Located in the function chromeHidden.handleResponse on line 22 of the script sendRequest
The "activeTab" permission was added in Chrome 26. Make sure that you've installed Chrome/Chromium 26+.
If you want to make your extension compatible with older browsers in the Chrome Web Store, add host permissions to the manifest file, plus the minimum_chrome_version key:
First upload an extension with the following manifest file:
{
"name": "Name of extension",
"version": "1.0",
"manifest_version": 2,
"permissions": [
"<all_urls>"
]
}
Then bump the version, change "<all_urls>" to "activeTab", add the "minimum_chrome_version" field and upload it again to the Chrome Web Store:
{
"name": "Name of extension",
"version": "1.0.1",
"manifest_version": 2,
"permissions": [
"activeTab"
],
"minimum_chrome_version": "26.0.0.0"
}