Kiosk mode in Node-webkit not working? - manifest

I'm trying out the basic tutorial for Node-webkit.
The manifest includes options to make your app go fullscreen or even in kiosk mode, which is exactly what I need.
Sadly, the app does not open in fullscreen or kiosk mode no matter what I put in the manifest file.
I'm on Mac OS, I downloaded "node-webkit.app". I am compressing my manifest.json and index.html into a "app.nw" zipfile, and then opening that with the mac app. Is there anything I'm overlooking?
My manifest file:
{
"name": "mydemo",
"main": "index.html",
"window": {
"title": "baby's first node-webkit demo",
"resizable":"false",
"show_in_taskbar":"true",
"fullscreen":"true",
"kiosk":"true"
}
}

OK, so I'm answering my own question here... don't use:
"kiosk":"true"
Instead use
"kiosk":true
I was under the impression JSON always uses quotes around properties...

Related

Why is my 'add to home screen' Web App Install Banner not showing up in my web app

I've created a service-worker and manifest.json file in order to display an 'add to home screen' Web App Install Banner for Chrome Browser Users.
It is not working as intended.
Here is my manifest.json file
{
"name": "MySite",
"short_name": "Mysite",
"start_url": "./?utm_source=homescreen",
"icons": [{
"src": "assets/cacheable/images/shortcut/120x120.png",
"sizes": "128x128",
"type": "image/png"
}, {
"src": "assets/cacheable/images/shortcut/142x142.png",
"sizes": "142x142",
"type": "image/png"
}, {
"src": "assets/cacheable/images/shortcut/192x192.png",
"sizes": "192x192",
"type": "image/png"
}, {
"src": "assets/cacheable/images/shortcut/192x192.png",
"sizes": "384x384",
"type": "image/png"
}],
"orientation": "portrait" ,
"background_color": "#fff",
"display": "standalone",
"theme_color": "#fff"
}
Please let me know if I forgot to add anything?
First, let's check if your manifest fulfills the requirements for showing Web App Install Banners.
Requirements
Full (current) requirements for showing Web App Install Banners are*:
Have a web app manifest file with:
a short_name
a name (used in the
banner prompt)
a 144x144 png icon
a start_url that loads
Is served over HTTPS (a requirement for using service worker).
Is visited at least twice, with at least five minutes between visits.
Reference
Okay, so for now let's assume this is all valid. Let's move on to testing.
Testing
To test if you've installed it correctly, you can try the following steps:
Open Chrome DevTools,
Go to the Application panel
Go to the Manifest tab
Click Add to homescreen.
A prompt should now show on top of your browser asking if you want to add the url to your things (on Chrome desktop).
Troubleshooting
If after testing you are getting the following error in your console:
No matching service worker detected. You may need to reload the page, or check that the service worker for the current page also controls the start URL from the manifest
Then please make sure that 1. Your service worker is functioning properly and without errors, and 2. Your start_url matches an actual url of your website that loads. Else, you will never get the prompt to show!
Additionally,
Do note that users (and you!) can also add to the home screen manually through the the (Android) Chrome menu. It is not required to wait for the prompt! I add a lot of websites I tend to use daily to my homescreen, and I hardly ever see a banner!
* Do note that these requirements could change from time to time (they have before!). An update to 'Add to home screen' coming in 2017 has already been announced here
** Also note that these requirements differ significantly from native app install prompts.**
your manifest.json seems good enough.
and the above mentioned points by #Extricate are correct and perfect.
So the next question is have you implemented service-worker for your app?
I read somewhere that an empty service-worker file would work but when I tried an empty implementation of service-worker, it said that
'Site cannot be installed: the page does not work offline'
So I suppose that latest chrome version would not be supporting the A2HS prompt for APP INSTALL BANNERS if you service-worker dont support offline working.
You can try going to Basic web app prompt , go to devtools in chrome, navigate to Application tab.
There you will find manifest.json. On LHS of the manifest file, you can see the ADD TO HOME SCREEN. When you click, it will print
'Site cannot be installed: the page does not work offline'
PFA screenshot for same
In your service worker js file add this one line of code:
self.addEventListener('fetch', function(event) {});
May be usefull, as had similar issue. The Install infobar appeared once and never again.
From Developers Google
The mini-infobar will appear when the site meets the criteria, and
once dismissed by the user, it will not appear again until a
sufficient amount of time has passed (currently 3 months).

How to launch my swf game in my manifest.json file for my Chrome packaged web app?

I'm struggling to get my first Flash game on the Chrome store as packaged web app.
All the tutorials I manage to find online are old and obsolete, or missing crucial info for a noob like me.
This is what I have so far for my manifest.json file:
{
"name": "Snappy Turtle",
"description": "Swim dangerous waters.",
"version": "1.8",
"manifest_version": 2,
"app": {
"background": {
"scripts": ["background.js"]
}
},
"icons": { "16": "favicon.png", "128": "icon.png" }
}
Somewhere in the mix I need something like the following so it will actually launch my game:
"launch": {
"local_path": "index.html"
}
},
but any way I try to add it I get errors, and of course, if I leave it out, no error report, but then the game wont run. ;)
Can any of you kind people who actually know what they're doing please point out to me the proper way to add this crucial bit in a way that chrome will actually accept?
You can't do it with a (new) Chrome App.
From Disabled Web Features:
Disabled: Flash
Workaround: Use HTML5 Platform.
You might get it working by embedding an external page in a <webview>, but I doubt it will work - my guess is that the ban extends to webview content.
FYI, all flash game "apps" in the Chrome Web Store are not Chrome Apps, but hosted apps (also called installable web apps). Note that the documentation for them is currently broken, there are still traces at this tutorial.
You can run it by doing this code:
<object>
<embed src="file.swf" width="100%" height="100%"></embed>
</object>

chrome extensions block from specific domain

Is it possible to disallow chrome extensions from a specific domain.
For example I want extensions that I install run on on other domain, but on the domain test.com I want no extensions at all.
I tried tools->extensions but there I can just disallow from incognito and some part of extensions everywhere.
Is it actually possible?
This is not possible. You have to either use incognito mode or create a separate user (chrome menu->Settings->Users) which doesn't have any extensions.
There's an Extension Automation that handles that for you:
https://chrome.google.com/webstore/detail/extension-automation/ghopjgdkodchjclkkfdekhjfomdbakkb
Automatically enables and disables extensions for specified sites. For simpler browsing and better performance.
The following code disable extensions for http://www.google.co.in/ and enables for other domains, you can customize it as needed; How ever it works only for extensions you create and at all installed instances
manifest.json
{
"name":"Browser Action Demo",
"description":"This Demonstrates Demo of Browser Action",
"browser_action":{
"default_icon":"screen.png",
"default_title":"Browser Action Demo"
},
"background":{
"scripts":["background.js"]
},
"manifest_version":2,
"version":"1"
}
background.js
function browseraction(){
chrome.tabs.query({"url":"http://www.google.co.in/"},function (tabs){
for(i=0;i<tabs.length;i++){
chrome.browserAction.disable(tabs[i].id);
}
});
}
window.onload=browseraction;

Chrome Extension: close background page after closing Chrome

I have an extension with a background page, and by default this causes Chrome to persist after you close all windows, and puts the Chrome icon in the system-tray. I would like to avoid this -- I do not want my extension to cause the Chrome process to persist after closing all Chrome windows, nor do I want to cause Chrome to appear in the systray.
According to the only docs I could find on this indicates that the user can set this option globally across all extensions, but that isn't what I'm trying to do. I'd like the extension to be unassuming / unobtrusive, and don't want to change the user's browser behavior. Does anyone know how to accomplish this while retaining the ability to have a background page?
UPDATE
With manifest version 2 you can now run event pages that are not persistent. Event pages are very similar to background pages but are only loaded when needed by the extension.
Example from the event pages doc on setting a non persistent event script in your manifest:
{
"name": "My extension",
...
"background": {
"scripts": ["eventPage.js"],
"persistent": false
},
...
}
Here is a tutorial on migrating your Chrome extension to manifest version 2.
OLD ANSWER
Currently, if your extension has a background defined in the manifest.json file, it will run before Chrome is launched and continue after all windows of Chrome are closed. That is unless the user changes their settings like you mentioned. There may be future versions of Google Chrome that allow for different functionality but you, the developer, won't be able to get around this issue at this time.
An excerpt from the background manifest docs
Makes Chrome start up early and and shut down late, so that apps and extensions can have a longer life.
When any installed hosted app, packaged app, or extension has "background" permission, Chrome runs (invisibly) as soon as the user logs into their computer—before the user launches Chrome. The "background" permission also makes Chrome continue running (even after its last window is closed) until the user explicitly quits Chrome.

Chrome Extension to Set Local Homepage?

Since it seems none exist, I'm trying to make a chrome extension to set my New Tab page to a local .html file. Here's what I have so far:
{
"name": "MyHomepage",
"version": "1.0",
"manifest_version": 2,
"description": "Set an HTML page as your New Tab page",
"browser_action": {
"default_icon": "icon.png"
},
"chrome_url_overrides" : {
"newtab": "/Users/shortname/Documents/Home.html"
}
}
However, when I load a new page, it gives me this:
No webpage was found for the web address: chrome-extension://(gibberish)//Users/shortname/Documents/Home.html
It seems Chrome is sandboxing my extension somehow. Is there a way to let it access my local file?
Chrome's extension API does not allow for direct reading or writing from/to disk.
If you want to do that you'll have to use a NPAPI plugin in your extension:
http://code.google.com/chrome/extensions/npapi.html
You can use Native Messaging instead of NPAPI https://developer.chrome.com/extensions/messaging#native-messaging