Chrome Extension to Set Local Homepage? - json

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

Related

How to restrict some url in chrome packaged app

I want to restrict some urls in a chrome packaged app, but when I try to use chrome.webRequest.onBeforeRequest.addListener in background.js in order to detect the call, I get error upon installing the app, 'webRequest' is only allowed for extensions and legacy packaged apps, but this is a packaged app."
My manifest is as below
...
"manifest_version": 2,
"app": {
"background": {
"scripts": ["background.js", "js/chromeUtility.js","js/customchromeserver/wsc-chrome.js"],
"persistent": false
}
},
"permissions": [
"webRequest",
"webRequestBlocking",
"*://www.xyz.com/*", // want to block this url
"identity",
"storage",
"webview",
...
How do I restrict a url in my chrome app , any suggestions ? Thanks
I could finaly do it since the url I want to block is loaded via webview, therefore I have checked it by using webview event listener for new window something like - webview.addEventListener('newwindow'), )

Why do I get "Unsupported extensions disabled" on my extension?

I did a Chrome extension, successfully published it on Chrome Webstore, a friend installed it yesterday, and today, when launching Chrome, he sees Unsupported extensions disabled:
What are the usual reasons for that? How to fix it?
Note: the extension is just a minimalist:
{
"name": "...",
"version": "1.0",
"description": "...",
"content_scripts": [
{
"css": ["fix.css"],
"matches": ["http://*/*", "https://*/*"],
"run_at": "document_end"
}
],
"manifest_version": 2,
"permissions": ["*://*/*"]
}
and a fix.css that modifies the design of certain elements. Nothing else is in the extension. It is still accepted/published on the Chrome Webstore.
This is because extension is not published in Chrome webstore. Perhaps installing Chromium browser can help. It should allow to use non-webstore extensions.
There is also bit complexated way to use pre-installed extension described here.
As recommended in this page:
Try this removal procedure ... http://malwaretips.com/blogs/remove-discount-buddy-virus/
Try running the new Google Software Removal Tool ..(Windows Only). Do Browser Reset at end.
You may also check this Important: Updates on Chrome Extensions.

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>

Kiosk mode in Node-webkit not working?

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...

Can't install my custom chrome extension crx_magic_number_invalid

I made a simple chrome extension:
manifest.json:
{
"name": "Layout VS Design",
"version": "1",
"description": "Enter the url of a image with your design at 100%",
"background_page": "index.html",
"browser_action": {
"name": "Manipulate DOM",
"icons": ["icon.png"],
"default_icon": "icon.png"
},
"content_scripts": [ {
"js": [ "jquery.min.js", "js.js" ],
"matches": [ "http://*/*", "https://*/*"]
}]
}
The thing is that chrome won't let me install it:
The thing is I have no idea where to set this number, Any idea what can I try?
The first thing I see is that your background_page isn't formatted properly. It should be
{ ...
"background": {
"page": "index.html"
},
...
}
If you manifest.json file isn't formatted correctly, Chrome will reject the extension.
You can read more about the manifest formatting in the Manifest File Format documentation from Google.
Update
Another SO post detailed how Chrome looks for a "magic number" at the top of a .crx file. But, if you're hosting locally, you can install extensions in a simpler manner.
Save your manifest.json and background.html to a directory (the name doesn't matter)
Go to chrome:extensions
Make sure "Developer Mode" is checked at the top
Click "Load unpacked extension..."
Select the directory with your background and manifest files to install on Chrome.
go to extensions page
check developer options
click on pack extension
set root directory (folder in which your images and manifest file
exist)
pack extension
now disable developer options
go to root directory (do not open root directory saying this only so
that you could easily find file otherwise you can open it)
you will see a .crx file just open it with chrome (e.g. drag and drop this file onto the chrome://extensions/ page)
click on continue (will come at the bottom of chrome window)
Your Chrome browser is modified like you wanted