how do I launch a chrome app from a web page? - google-chrome-app

I hope i can do something like
chrome://<magic-invoke>?param1=42&param2=woohoo
I tried doing a content script and setting up a function that a page could call, but content scripts aren't allowed in apps (and I want an app cos I need sockets)

Take a look at https://developer.chrome.com/apps/manifest/externally_connectable for details on a method that should do what you want.
Note for this to work your app needs to declare which pages can connect to it.

Related

OwnCloud enhance core features with App (eg. user registration)

I started looking into OwnCloud app development to add some capabilities I would like to my server. To me it seems like Apps can't modify anything like the Login page or User Management page. Is this the case?
I want to build a user registration app and would love to integrate it into the user management page (if not and it has to exist as its own app page not a big deal). The one big problem I see so far is not being able to add a "Register" link to the login page. I could just go in and add it to the source manually, but I would like to keep the App self contained so others can use it too.
If this is not possible to do in an App I may just need to modify the core application and then see if they will accept my feature addition in a pull request.
Thanks to anyone who can shed some light on this for me. I don't want to waste my time trying to figure out how to do it with an App on the platform if it wont be doable.
After a lot of digging around I did figure out a way to do this.
In the App's app.php file, you can force a script to be loaded if the plugin is enabled:
$api->addScript('script_name'); // without .js
In that script jQuery can be used to add the elements to the page where you need them.
This was a good solution for me since I only needed to add a single button to the login page. I can see this being a bad idea if you want to make vast modifications. At that point you might as well just create a separate page that you have full control over.

How to embed content script into web views?

I want to work with the content in the webview (eg. submit a form) - for this, I thought I could do this by embedding some scripts into it. But when I use content_scripts, I get a warning saying 'Content Scripts are allowed only in legacy packaged apps"
I searched about 'Legacy packaged apps' but couldn't find any information about that via google.
Is is possible to insert content scripts into webviews in Chrome apps? or is there any other good alternative solution to get this.
thanks.
Try ExecuteScript rather than content scripts in webviews. It's almost the same as the programmatic-injection kind of content script that you're probably already familiar with.

Grabbing Text from a website using xcode

what i am aiming to do is make an app that grabs text from a website and auto updates when the text on the website changes, does anyone have any ideas or any solutions that could help?
I think you can use Javascript for taken text you need. Also you can use NSRegularExpressions (but it's worse variant). For autoupdating - you should be delegate of UIWebView and check your text in didFinished… method.
Do you mean an iPhone web app? If so do the following:
<head></head><body><?php include ("pathtocontent/content.php") ?></body>
And save as e.g. index.php
Put in the content.php file:
<p>content.</p>
Or anything else you want as content.
Then in the iPhone website do the same. Then you only have to update content.php in order to cjhange both the websites
Look at NSURLConnection, send a request to the website, the data will be in the response

Browser plugin for cross-domain iframe communication

I would like to create a browser plugin/extension that would allow the browser to read contents of a cross-domain iframe. I understand that this isn't possible with javascript, but perhaps someone could point me in the right direction of how to create a plugin that users could install. A cross-browser solution would be ideal.
Specifically, I am creating helpful navigation utility, and I want to know the url of the iframe so that I can prevent the iframe from navigating to any questionable sites accidentally. I would also like to detect the size of the contents.
Thanks in advance.
Option 1: file_get_contents:
What you can try is to get the contents from the page by the PHP function file_get_contents, load the CSS files and get the contents and the size of the page.
Option 2: Headers:
You can start here: http://www.senocular.com/pub/adobe/crossdomain/policyfiles.html
See the "allow-access-from" section where you can allow domains to be accessed cross domain when they have specific headers.
Userscripts have cross-domain XMLHttpRequest, and they will even run on all browsers. They (or at least Kango's Content Scripts) have the ability to write and read stored values for cross-window communication.

How do I implement a Floodlight tag into an iPhone app?

A client is asking me to insert a Floodlight tag into an Objective-C programmed iPhone app that is ready for submission to the App Store.
I did some Googling, and couldn't find anything about how to do this (it seems like you can you only add Floodlight tags via Javascript, but I'm not too sure). Can you do this, and, if so, how?
If nothing else, you can create an offscreen UIWebView and invoke the appropriate javascript with stringByEvaluatingJavaScriptFromString. Not a good solution, but if javascript is required it may be your only choice.
Instead of embedding a UIWebView right off the bat for this, you could try using NSURLConnection to request the URL normally inserted with the Floodlight iframe. It seems that unless the contents of the iframe (which should just be a transparent GIF) need to interact with the host page, simply performing and receiving the request should fulfill the purposes of tracking. Check the ToS, though, to see if they have any stipulations about this.