If you visit maps.google.com on a mobile device, then press 'Menu', 'Get Directions', and select the 'transit' option, you are taken to a page where you can enter two locations and a date/time, and get directions on public transit. However, the URL is still maps.google.com.
Is there any way to link directly to this page so that I can load it in a UIWebView in my iOS app? Would 'clicking' the buttons in Javascript be (the only/a good) solution?
Try: http://www.google.com/transit
Even clicking the buttons in javascript doesn't seem to be working. The Google Maps code is a little strange- the event listeners aren't assigned directly and I can't get a .click() to work. So what I'll do is have the user enter the two locations in boxes in the app, then load something like http://maps.google.com/maps?f=d&source=s_d&saddr=Coover+Hall&daddr=lied+rec+center in the UIWebView, except I'll add some more specific location information before building the URL, since this is a city-specific app. Not a perfect solution but it gets the job done.
You could create a URL that links to the transit directions with the "dirflg=r" paramater.
Find the other URL parameters here: http://web.archive.org/web/20110714031648/http://mapki.com/wiki/Google_Map_Parameters
Related
I have a question about an app page function on Facebook.
https://www.facebook.com/InternationalDelight/app_481604621851046?ref=ts
in the link above there is the blue stick header, followed by a silver or white bar with four items.
An avitar/icon image
A button that allows a direct link to the owner's Facebook page attached to a another drop down button.
Now the last button is the one I am curious about. It allows the splash page (in the content area) to be liked then it redirects the person to the offer.
I have my app in sandbox mode, I am wondering:
Is this is an app that I can add
Is it a custom built function
A standard feature that I have not seen because my page is not live.,
How I can duplicate the functionality of the entire bar?
I have dived into Facebook the API and Facebook graph but I honestly don't know what to look for or what it is called.
On inspection the container div says...'stickeyheader' probably becasue it is sticking itself to the blue header...or timeline and 'timelineStickyHeader' and 'visible'... but how they got it to behave this way is beyond me.
Anyone familiar with this action/event? Let me know if I need to add more details.
Thanks!
Here is the answer (in case anyone bumps into this down the road). There are a few steps to putting your app on Facebook via and iFrame (basically a application that is hosted somewhere else but that requires some Facebook like button interception.
First you build your application. Creating a landing page (this will be tabbed later). In the header of that page look to intercept the user Facebook date to see if they currently like your page. If they don't then set up a function that stops them. If they like the post back/processing of the page on the like button click will set the conditions for the user to pass through to the app. This is like-gating.
Now, to develop the application you have to go to developer.facebook.com and create an account. There are two ways you can intercept the like/user date...
Here was my original code (it is in Coldfusion and Javascript):
<cfscript>
//Decode the signed request
fb_str = listToArray(FORM.signed_request, '.');
//Facebook use strtr
fb_str = replacelist(fb_str[2], "-,_", "+,/");
//For some reason their base64 needs padding out to match a base64 length
pad = repeatstring("=", 4-len(fb_str) mod 4);
//Decode it
result = ToString(BinaryDecode(fb_str & pad, 'base64'));
//JSON-ify it
liked = deserializeJSON(result);
//Clean up and release memory
fb_str = pad = result = '';
</cfscript>
<cfif liked.page.liked eq 'YES'>
<script type="text/javascript">
top.window.location = 'http://apps.facebook.com/parentsavvybook/';
</script>
</cfif>
That goes on your Coldfusion page (or other server-side scripting equivalent).
More can be found here: http://www.facebook.com/note.php?note_id=10150169691075844
Then in the developer tools you want to choose web app, then click the button that says create a new app. Fill in the application information, like what the domain is, and the name of the app.
The important stuff is the tab set up.
Add your app URL (where your web app is hosted to point to the page that has the FB script code/redirect stuff.
Once it is created you'll have an app ID and app URL.
The KEY
The key was this little stupid bit of code.
http://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&next=YOUR_URL
Why was this important. Well the Facebook page might be managed by you, but you will not be able to attach it to the page. You'll go crazy for days trying to get it linked up.
Fill in the missing parts above and go to the link.
You'll be prompted with a drop-down that will let you attach it to your page, or a page you manage.
Here is another post that hits the high points.
http://blog.hubspot.com/blog/tabid/6307/bid/26330/How-to-Create-Custom-Tabs-for-Facebook-Business-Pages.aspx
I hope this helps someone who struggled with FB apps and tabs to get the like button and how to interact with it and then finally attach it.
I will try to explain a bit the context for my problem.
Context:
A while ago I started working on Facebook application. One of the requirements is to be included in a Facebook page as a tab. This application will contain on a page a send button in order to be able to make it more engaging with specific people, users of the application would choose on their own. The reason behind this is because the Facebook page containing the application is related to alcohol, and "liking" the application will get more audition and potential children. Another reason for using send button rather then other similar options from Facebook (like send dialog etc.) is because in Facebook documentation was stated that send button works on mobile devices and other options don't.
Problem:
My problem is related to the send button. What I need is to be able to completely configure the send button: url, image, title, description. I have research the open graph tags in order to be able to do this. Everything works fine if the page I want to be sent with the message is a website OUTSIDE Facebook. Once I started to use the url of a Facebook page (let's call it www.facebook.com/mycustompage), then the crawler takes the images, title, description from facebook.com ignoring the actual page and the produced message is not what I want.
I have searched a lot to better understand this limitation and could not find anything relevant.
The only article I could find as a potential solution was (and even this I had trouble finding):
Send button returning error codes, like button works fine
The above discussion is a workaround which I have already put in place but is not 100% what I want. The described workaround is about putting in the send button:
<div class="fb-send" data-href="http://www.mycustomdomain.com/og"></div>
a page that sniffs the user agent. In case the user agent is Facebook crawler to serve an html empty page just with the open graph tags, otherwise redirect to the desired URL - which in our case is the facebook page www.facebook.com/mycustompage.
The message produced contains:
the title which is a link to www.mycustomdomain.com/og which when
clicked opens a page in a new tab with the address
www.facebook.com/mycustompage - this is relatively ok
under the title I have a "sub-title" readonly text containing the domain of the link: www.mycustomdomain.com - THIS IS NOT OK since I don't want to share where I have hosted the application.
the image and the desired description - this is ok.
Conclusion:
What I want to know if there is a better way to do this rather than this workaround.
If not I would like to know how I can hide for the produced message the "sub-title" so that the hosted domain is not visible.
I'm writing an iPhone web app using HTML5/CSS3. I need to embed a link to open a built-in maps app from my web app. To open a location on the map I redirect mobile Safari to URL like this:
http://maps.google.com?q=Business+Name%26+Street+Address+City+State+Zip
In this case if a user taps on this link the iPhone opens up the maps app and displays the location specified in the URL.
But when I need to provide a URL for driving directions to a predefined location:
http://maps.google.com/maps?saddr=1234+1st+ave+portland+or&daddr=Business+Name%26+Street+Address+City+State+Zip
I've encountered a strange situation when in some cases the iPhone displays a pupup message:
Open this page in "Maps"?
with a choice of yes and no, and only if a user taps Yes, the maps opens up with directions. Note that this popup shows only for some addresses.
Is there any way to prevent this popup from showing at all?
I've created simple web page. Put a link and set google map link with query string value of particular address on src attribute of link element,run it to my iPhone 4.It is working fine, I'm not getting any window to ask it open on map app.
I noticed that you've used "saddr" as a query string parameter. You can replace that with "q" query string parameter.
Is there a way to link to directions in the iPhone map app from a html page?
We're placing an add in an iPhone app which will link to a mobile page on our website - we'd like to add a directions link, thus far google searches have been unrevealing.
A link to http://maps.google.com/maps will automatically open in the map application
You can set a destination address (daddr) and start address (saddr) in the link:
http://maps.google.com/maps?daddr=San+Francisco,+CA&saddr=cupertino
You can see some more options at:
https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html
Here is a javascript function that creates the link:
function mapLink(myAddress) {
return 'http://maps.google.com/maps?q='+escape(myAddress);
}
This works great on the iPhone.
If you use the standard link that would display a map in the browser, it will automatically open in Google Maps on the device. That includes links that show directions.
Use something like:
<a href='maps:daddr=<destination>&saddr=Current%20Location'>Directions</a>
where may be a lat/lon pair (separated by a comma) or a place. Ensure you URI encode the destination to ensure it works.
in titanium, i'm using the webview to display a wordpress blog page, that is already formatted for mobile browser. instead of writing my own interface, this works as a good work around. the apps sole focus isn't the browser.
but my issue lies, when the user clicks a link outside of the initial displayed domain. i only want the main domain to be displayed in the apps browser. if any other link is clicked, that takes the user outside of that domain, i want to have it open in the phones default browser.
can anyone point me in a direction for this. i tried adding a listener to try and catch link clicks, however, i've been unsuccessful.
thanks
in this blog posting I show how to find links in a webpage and change the link behavior. Using the same method, you can intercept the links and redirect to opening the URL in the devices default browser
One solution would be to catch the onclick() Event by Javascript inside the WebView (your blog code) and handle this by a custom handler. Maybe you can inject the javascript event handler code into the running WebView through Titanium.
Another solution is to make your blogposts readable for app technology and create a new data interface. This is the way I would do. For that I would use some kind of JSON data format and a simple REST Interface to get the data.
I don't think bove solutions are that simple. If you want an app with "great feeling", you'll have to handle the events by your own. Maybe Phonegap would be a better solution four your problem. But there you will still need a kind of REST/JSON interface for your blog data. The idea behind an app is, that the main code is in your app and you get the content from a remote source. This way you'll get an advantage compared to a simple browser optimized site.