Chrome Extensions: Getting Content Scripts To Work - google-chrome

I am learning how to build simple extensions that use content scripts. To do so, I am tweaking existing sample extensions to get a lay of the land -- or at least that is the goal.
Problem is, none of the sample extensions that use content scripts seem to work for me. Two simple ones that should work but are not are: Email this Page, and SandwichBar (Direct link to zipped extension folder http://developer.chrome.com/extensions/examples/api/infobars/sandwichbar.zip ).
I am using Chrome 16.0.912.75 on a Linux box. Any ideas why this might be the case? Conflicting extensions or overriding flags? I would really appreciate any suggestions.
Thank You!

Sandwitch bar do not work because it uses info bar experimental API manifest version 2

Probably because you're using a really old version of Chrome (in internet years at least). They change the APIs from time to time, and probably something they've done in the interim has broken content scripts in Chrome 16 (for example the change from sendRequest to sendMessage). Isn't a more recent version of Chrome available for your platform?

Related

What are Chrome apps vs plugins vs extensions and how to develop them

I am trying to understand about Chrome (browser) development. I am very new to this and trying to figure out where to start in order to develop for Chrome Browser.
Just have a couple of questions:
What is the difference between Chrome Browser apps vs. plugins vs. extensions (not sure, if this question make sense. But, hope you got what I am asking for)
What kind of applications can I develop for Chrome Browser
What technologies do I need to learn in order to develop for Chrome Browser.
To answer your first question this explains the differences between apps and extensions (I think there's no better way to explain their nature):
https://developers.google.com/chrome/web-store/articles/apps_vs_extensions
What do you mean with "what kind of apps"?
You can develop both hosted and packaged apps if is that what you intended, give a look at this:
https://developers.google.com/chrome/apps/docs/index
Anyway the easiest way to start would be by building an extension, how-tos and
good documentation makes it good to start with:
http://developer.chrome.com/extensions/getstarted.html
Just to add to the above answer which was missing difference between Plugin and Extension is:
Plugin is a third-party library that is plugged-in to the browser and allows for being embedded on a webpage. It affects only the web page that is using the plugin.
Extensions change the browser UI, add menus or change overall look of the browser and can process each page that gets loaded.
So to sum it up - plugins add functionality and extra features to a particular webpage while extensions add functionality and features to the whole browser and change the behavior of the browser.
Just to add on new information since people may continue to hit this question: Chrome has basically deprecated plugins as of March 2017 (Chrome 57). If you go to chrome://plugins now, you won't see anything (you used to see a list of installed plugins with enable-disable links like for extensions).
It seems the reasoning is that the only plugins they actually wanted to allow you to enable/disable are Flash and PDF Viewer, both of which were moved to the Settings menus (if they weren't already there, not sure). The rest are considered to be integral parts of the browser. https://www.ghacks.net/2017/01/29/google-removes-plugin-controls-from-chrome/
Makes things a bit simpler to think about now.

Getting the web page content, similar to Readability as service

I'm looking for some facility for getting out clean HTML content for different pages (blog articles, magazines etc). The basic idea is how the 'Reader' in iOS Safary works.
This answer I can up that iOS Safary uses Readability for content parsing. Unfortunatelly the API does not include any methods for parsing, instead saving a bookmark and getting it's content, which does not suit me much.
Another answer here suggests to use https://www.readability.com/api/content/v1/parser but it does not work for me.
Any suggestions for similar services?
Have a look at Tranquility. It is a Firefox Add-on so you can look at the source. You can download the XPI and unpack it. Then look into content/tranquility.js and the related files in content/.

Any Idea on on how does the HTML 5 Terminal work?

I happend to stumble upon this site
http://www.htmlfivewow.com/demos/terminal/terminal.html
It is simply amazing. I was just wondering on how is the terminal being emulated in the browser ? Can we embed the terminal in the browser and use it normally ? If so how?
i found this link which kinda enlightens the architecture http://www.htmlfivewow.com/slide33
But one thing aint clear what exactly is CRX-LEss Web app ? its completly new term , i havent herd of it before ( googling dint quite help me )
The actual presentation for the demos is from the Google I/O conference, and the talk was called HTML5: The Wow and the How. If you watch the video, they go over everything that's implemented in the terminal demo:
http://www.youtube.com/watch?v=WlwY6_W4VG8
It's very cool stuff.
A great thing about the web is that on any page you can View Source. Give it a shot. The source is well-structured and though it could be better-commented it's pretty straightforward. Even if you don't understand it in its entirety it will give you a place to start searching for the techniques used.
With JavaScript, the DOM, and <canvas> (which, I should mention, isn't used in this instance) just about anything can be created, from terminal emulators to Nintendo emulators.
A CRX-Less web app is an unzipped Chrome extension and points to the manifest.json file for the extension. It is an experimental feature and must be enabled in the chrome:flags page. https://developers.google.com/chrome/apps/docs/no_crx explains how the process works.

Hiding Chrome bookmark text via extension

I'm trying to get a start in programming by writing a Chrome extension similar to the Smart Bookmarks Bar extension for Firefox. Java seems straightforward enough, and I can probably figure out the specifics of building an extension but I can't find out what commands I need to change the rendering of the bookmarks.
1)Does anyone know where I could find the relevant documentation?
2)Does anyone know of extensions that interact with bookmark rendering I could take a look at the source code of?
Everything you can do with the bookmarks is listed in the API:
http://code.google.com/chrome/extensions/dev/bookmarks.html
(and as someone said here on SO: java is related to javascript as a car is related to a carpet :] )

embed html in foreign website

I would like to know if somebody knows a method to embed custom html in foreign websites.
Maybe there's a firefox extension or something like that (like stylish for example, but for html instead of css)
Actually, that's where the Greasemonkey Add-on is for. Once you have that installed, you can create scripts which manipulate the DOM of any website you would like:
Allows you to customize the way a
webpage displays using small bits of
JavaScript.
Hundreds of scripts, for a wide
variety of popular sites, are already
available at http://userscripts.org.
You can write your own scripts, too.
Check out http://wiki.greasespot.net/
to get started.
Also nice to know is the fact that the latest version of Chrome, and also Opera (don't know since when, but longer than Chrome) supports userscripts out of the box (no need to install any add-ons).