I have a chrome app which are getting user keystroke and screenshot, it is working properly by it self, but I want to get keystroke and screen shot from other opens chrome apps, which I have to get all open pages and inject my script to them, does any body know how can I get the list of all open html pages and also how to inject script to them?
You can't do that with Chrome Apps.
They are self-contained by design and cannot interact with the browser this way, let alone other apps.
Related
I'm trying to develop a Chrome extension that is supposed to completely replace a specific website's pages with a new UI. In other words, when the user visits said website, the extension should "intercept" it seamlessly and display the new "app" (preserving the URL and without opening a new tab or window). I currently use a content script to manipulate the DOM, but it's too messy.
Chrome apps such as Google Docs achieve the same goal through URL handlers, but they're not an option since they're now deprecated.
Currently, I'm aware of two options:
Intercept the URL and redirect it to an extension URL. I want the URL to be preserved.
Use a content script to stop the page from loading at document_start (using window.stop()) and then "inject" the new app. Apparently, that works, but it sounds quite hacky and prone to unexpected glitches.
What I'd like to know:
Is the second approach good enough? What limitations and other issues will I face if I use it?
Is there any other approach that is at least as good (and preferably designed for this purpose)?
You can't open a chrome app in a tab, only in a window. I don't think they have content scripts either.
Also, chrome apps are now only available on chrome os when you publish it for the first time (existing chrome apps work for any os).
To solve your question, you could use an extension with content scripts and just open up an iframe fullscreen so the url is preserved in the omnibox and it could have the page you want in the iframe as the page that would be in the app.
Content handlers are meant for opening a special protocol url to do something like send an email, etc. Examples would be like tel://, sms://, mailto:, etc.
So you would not want this. Also they aren't that noticable when approving to handle the protocol.
Good morning,
I have create a script with the extension CJS( custom javascript for website) for chrome that click and inject script on several page of a same domain automaticly, the script detect when the page change and alert me(with a simple alert()) about a new content in the page.
It works perfectly but I need to let open the web page, I put it as homepage but I don't wanna inadvertently close it. So I have create an extension with an iframe that contain the site witch I want insert the script but the extension CJS does not works on chrome extension.
The problem is that the site is in https so event if I disabled the Content Security Policy (CSP) I can't get the content of the iframe and inject script myself.
So my question is how to have a background page of an external site that let me execute script with chrome.
The extension is for personal use, I don't need an universal solution.
Thanks
edit:
the iframe appear in the default_popup:
I'm trying to open an html page (I get it as a string and parse it) from my fullscreen iOS web application (standalone).
I tried opening a window (window.open) but it doesn't work.
It involves handling a payment method, so I can't redirect back from their page to mine (it's an illegal hack) when I finish.
How can I manage opening the html file in safari and going back?
I don't know of a way that a standalone mode web app can serve up raw HTML to the user without it being hosted somewhere.
If you have a genuine web URL though, you can have the user click a link with target="_blank" (new tab) and it should open in Safari, instead of the standalone browser. I don't think you can do it via window.open(), because it will be silently blocked as a "pop-up".
I am monitoring browser events such as when a new tab is created. My extension needs to display these browser events in the new tab page.
To make versioning easier I would like the extension to be as dumb as possible. That is, all it needs to do is tell me is that a tab has been created and I need to be able to tell the extension to switch to a tab. Then I do not have to worry about what extension versions people have installed.
The new tab page so far is a redirect to my single-page app hosted on my server.
My options seem to be:
Using custom events to send messages between the content script and embedding page: http://code.google.com/chrome/extensions/content_scripts.html#host-page-communication
This seems like a security risk as the page javascript will also have access to the DOM and hence the messages I am exchanging.
Loading the HTML from server into an iframe, pulling application JS from server and injecting it into the iframe as a contentscript. This allows the app's JS to have full access to the chrome extension API which is what I need.
Another consideration is that my project is currently using RequireJS. For option 2, it seems I won't be able to use this.
Can anyone recommend the preferred option keeping in mind the security risks of option 1?
Will I be able to use RequireJS with option 2?
Is there another way to acheive this?
I am new to extension programming but find making extensions in Chrome much more easier, but now that I am trying to port my test extensions to FF I have a few questions of how to do the same things I do in Chrome... now in FF.
For example:
In Chrome I have a page in my extensions directory called: domains.html
I link to that page from my popup and it has access to all my scripts etc but the "outside" world cannot directly access that.
Is there any such thing in FF so that I can show a page that is in my add on folder and has access to my add-on's JS and other files?
Thanks!
Take a look at some of the docs for opening URLs in new Tabs and manipulating the content of the tab:
https://developer.mozilla.org/en/Code_snippets/Tabbed_browser#Opening_a_URL_in_a_new_tab
Once you get comfortable with that, try opening an HTML page that lives in your add-on. First, you need to be aware of the 'content' package name you registered in your chrome.manifest file. Second, make sure your 'domains.html' file is in the content folder of your add-on. To open the web page in a new tab using a button or menu in Firefox use code like this:
gBrowser.addTab("chrome://mypackagename/content/domains.html");
You can should be able to load other JS and CSS files from your add-on into the web page using similar chrome:// URIs.