Embedding a chrome native app into an existing tab with content scripts - google-chrome

I am not so certain this is even the right approach. Essentially, I would like to control some WiFi lights (Milight/LimitlessLED brand) so that I can fade out and fade in lights when videos are played on YouTube, Netflix, and other similar services.
The only way to communicate with the lights is by sending UDP messages, and it seems the only way I can access a UDP socket in chrome is either through a chrome app, or a native app.
Native apps seem better, as I can bundle them along with an extension while I don't seem to be able to do that with a chrome app. But in the examples I've seen in documentation, a portable native app (PNaCl), is embedded into a page using <embed>.
Well, a content script can create an tag, but then how could I load the native app without violating the same origin policy? Or would there be a better solution to what I'm trying to do?

I'd create the embed in a background page. Then have your content script eavesdrop on the event that causes the video to start playing, have it send a message to the background script. Then the background script can control the embed by triggering appropriate events.

Related

Chrome* api access from my page js

I want to find out if any tab is playing sound on my webpage. Chrome had chrome.tabs api which tells if a tab is playing any sound. How can I access those chrome apis on my page.
You cannot, unless you make an extension to do that for you.

Custom protocol handler in Chrome?

We have a mobile product, which runs in a WebView, and talks to our iOS / Android SDK's over a custom scheme:// (inserting an iframe with this in the URL). This is notoriously difficult to debug, and I'm trying to figure out if it's possible to catch these calls in a custom Chrome extension. I understand I can "redirect" using navigator.registerProtocolHandler, but I'd like to be able to "respond" (in the case of our SDK that means injecting Javascript into the page) to these calls. Is this possible?

Silverlight web application loading an external page in the app

Basically i have an application that needs to be able to navigate to a webpage on the app whilst in the browser in silverlight how can i go about doing this?
It does not let me use the web browser tool and i cannot find any other way. I dont think i will be able to use an iframe either as i need to be able to draw a canvas over the webpage that can then be drawn upon using a paint tool and i dont think using an iframe will allow this.
So how do i go about getting an external website to load inside of my web silverlight application?
You're right, there is a WebBrowser control but it is only available when running in out of browser mode.
I'm afraid at the moment, the only way is by using an Iframe (spent many hours searching).
I managed to get it working OK by using this tutorial: Showing HTML content inside silverlight app
However for your requirements (drawing on top of the webpage) this will not work, as it does not allow the Silverlight app to integrate with the html content.
The only option that i can think of is setting your app be be out of browser, then using the WebBrowser control
But this will not be appropriate as i've just noticed that your app needs to be accessible through a browser!

How to stop the detection of a chrome extension?

Ethics aside, how could I run a chrome extension on a website without it being detected by that website?
As long as you don't modify the DOM, don't respond to any message passing from the site, and don't make any extension assets web accessible, I'm not aware of any way for the site to tell. The JavaScript runs in a different context that the page doesn't have access to.

Open Chrome app within Chrome's main window

I'm fairly new to Chrome app development and was wondering if it's possible to run an app within Chrome's main window, like the TweetDeck app.
Thanks!
No. Chrome Apps' current goal is to provide a native-like app experience outside the Chrome browser. Today, with the exception of certain privileged APIs, putting an app in Chrome would be... well, it would be a website.
If you want an app in one of Chrome's tabs, why not just build a website? What does the open web lack for your project?
Note that we have been thinking about what it would mean for an app to be a component inside a webpage. You could imagine a Facebook Like button or a Google+ +1 button implemented as an app in a webpage in the same way that those buttons today are usually implemented as iframes. There are some interesting security properties that this approach would bring over iframes. But again, this doesn't seem to be what you had in mind. What you had in mind appears to be a regular website.