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

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.

Related

Embeddinig another website into a GWT application

I'm building a GWT application that looks great. At the end of the page I'd like to include a WordPress blog that I'm developing. In order to do that I want to use a com.google.gwt.user.client.ui.Frame so that an IFrame gets created, and the Wordpress just gets seamlessly embedded.
I've built this and it seems to work, although there's a problem with the size of the IFrame. I'm not sure how it's getting sized, but it's too small so that scrollbars are thrown onto it. This makes the the embedding not so seamless.
What should I be doing so that this second webiste can be seamlessly embedded into my GWT app?
The easiest solution is to make iframe as big as possible, and hope that there will be no unexpected scrollbars.
Also there is another way, if you have access to the innerDocument of iframe (if SOP doesn't stop you from doing this), you can compare its size against the size of iframe, and increase iframe height/width if necessary.
If blog is in another domain, you might try to use cross-document messaging to retrieve information about the size of document(this will not work in IE7,IE6 and you will have to put some additional JS on your blog).
Also you can include information from your blog without using iframes. You can simply pull RSS of your blog, parse it and display it in any way you like it.

iphone html app - cross site xmlhttprequest?

On an iphone, you can add a favourite when on a webpage and if that webpage has the correct meta tags for iphone, it gets an icon and can even 'hide' the browsers chrome and display just like an App. With html5 http headers you can even have the phone completely cache the 'app' so that it never has to contact the server again.
The problem I have is that I want to write apps that make xmlhttprequests to a server that is not the server they were originally from. I heard its possible to do this if you somehow export your favourites and HTML5 chache then manually edit the export file to change the URL for the favourite, then import them again, so that the phone doesn't think the javascript is trying a cross site xmlhttprequest.
However I have not found anything like that (maybe it was a jailbreak thing?). At the moment I have to have a proxy on the server where the 'app' originally came from, which is obviously very annoying.
I also heard that there was a special meta tag that allowed you to specify one other domain for xmlhttprequest, it had something to do with specifying that the page was actually a mirror and should be treated as if it came from another domain. Does anyone know what meta tag this is? I tried searching all over apple and found nothing.
I believe it might also be possible if you can get webkit to treat the cache as a file:// protocal, because then cross site security will not apply.
The answer is this is not possible and is not meant to be possible.

Cross-domain navigation within Blogger without Javascript

The setup: I have a Blogger blog set up on a domain name as blog.mydomain.com. The main site site at mydomain.com is running Umbraco CMS.
The problem: I need to have the navigation from the CMS transported to Blogger somehow, so that making a change on the main website doesn't require the extra step of modifying the navigation inside Blogger.
Generating the navigation data on the CMS side in what ever format it needs to be (XML, unordered list, JSON, etc) is not a problem. The problem is getting the data from Umbraco to Blogger after it is generated.
I'm not yet willing to use Javascript, as this would seriously impair the website for users browsing without Javascript. (Too bad because AJAX would be a very workable solution.)
I've tossed around the idea of using an iFrame. How would this work for a navigation system including sub-menus? Creating and deleting multiple iframes is out of the picture, since I don't want to use Javascript. I could use one large iframe to allow for the sub-menus, but then it would cover content at the top of the content area, rendering it unclickable.
I'm thinking about how you could do this, but while I do - in this day-and-age javascript has become very common. Most users are going to have it, and those with it disabled really shouldn't be on the web. Is this the only reason you don't want to use javascript? Around 2% according to YDN have js disabled, and that's lower from other countries. As time goes on that 2% should get lower, I don't see that as an issue. However if you absolutely can't use javascript, I'll keep thinking. I might have an idea, I'll need to test it though.
It's not possible to use IFrame, cause of same origin policy. Both sites are on different domains, when user click menu item inside IFrame, there is no way to call parent window.
There are few ways how this can be done.
1) Javascript solution. Use json rpc, or another cross-domain calls. Load menu from your CMS and render it. Yes, this requires javsascript, but, seriously, show me the site, which does not use javascript.
2) Direct server communication.
Is it possible to perform http call from blogger ? If so, just perform http call to your CMS from Blogger, get data and render it.
3) Mixed flash/javascript solution. Flash can perform http call regardless of same origin policy. Get data with flash, use ExternalInterface to call Javascript function to render data.
There is no another way to do it. I suggest you to use javascript solution
You could build an HTML skeleton of empty ULs in Blogger (the max that you might need) to hold your navigation contents, and then link to an Umbraco-generated external stylesheet.
This stylesheet could fill those LIs with CSS generated content using the :before and :after pseudo-elements, and hiding unused LIs with CSS display: none.
An example of this is at: http://jsfiddle.net/5bXja/1/
This works in IE8+ so depending on your clients, this may-or-may-not be more widely supported than Javascript. Likely not. ;-)

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

Accessing UIWebView contents from UI Automation in Instruments

I have a UIWebView in my application which has links inside that when clicked cause different actions to be carried out in the application. I'd like to be able to test this with automated testing so it can be added to a continuous integration build. However, the documentation is rather sparse for UIAWebView and I've tried to no avail to get this to work.
Has anyone had any success interacting with links inside a UIWebView so you can check that their action is correct?
Couldn't find a way to iterate/access links in a UIWebView but would this work for you? Access the page source with:
NSString *source = [webView stringByEvaluatingJavaScriptFromString:#"document.getElementsByTagName('html')[0].outerHTML"];
then look for the tags that you consider to be links (e.g. href=...)
Then you still need to be able to "press" those links. Is it enough that you navigate to the url given in the link? If so, just use loadRequest to do so. If you need more advanced behaviour (for example make sure correct javascripts are run), you'll need to do more magic to parse those and execute them with stringByEvaluatingJavaScriptFromString.