Facebook Feed Dialog API how to include a redirect_uri containing a #? - facebook

How can I specify a redirect_uri containing a #?
Facebook Feed Dialog API parameters reference
redirect_uri - The URL to redirect to after a person clicks a button
on the dialog. Required when using URL redirection.
This works as expected when the redirect_uri in question is a regular URL, however, when it contains a # it stops working.
When redirect_uri is http://website.com/foo, it redirects to:
https://website.com/foo?post_id=100006935442054_1384656491776519#_=_
Not sure what the trailing #_=_ is for, but it does not cause any issues here.
When redirect_uri is http://website.com/#foo, it redirects to:
https://website.com/?post_id=100006935442054_1384656491776629#_=_
Thus it appear that either the parameters after the # are ignored, or overridden with #_=_
Given that I am working with a single page application, whose routes are driven by the hash fragment, this breaks my ability to deep link within my application.
Any help/ suggestions on how to work around this would be much appreciated!

In your application you can handle query strings as if it was a hash tag, or simply do a redirect.
For example, if your route is http://website.com/#foo, make http://website.com/?hash=foo do the same thing or redirect ?hash=foo to #foo

I'm working on a problem like this right now. The URL to go in redirect_uri and link:
.../xfile.jsp?item=/contests/bhg_homeimprovement/bhg_splashsweeps_win2500_homeimprovement&temp=yes&hid=#HashID#&esrc=nwbhgsweeps072514a
The FB dialog gets an error as is. Encoding the full URL fixes that and does output hashes around "HashID", but the equal sign before it is removed. Adding a 2nd equal sign there will output 2 equal signs, but having just one will output none.
This isn't a complete solution but it does look like hash marks are possible.

Related

ee: redirect url with trailing forward slash

How can I redirect to the correct page if somebody adds a trailing forward slash to a url in expression engine?
For example:
A) www.acme.com/event - is the correct url
B) www.acme.com/event/ - has the same content
The problem is I'm using Disqus as a commenting system and it interprets both as different pages. So the simple solution is to redirect to url A when the trailing slash appears.
{if segment_2=="event/"}
{redirect="/event"}
{/if}
This doesn't seem to work. Any ideas that don't involve .htaccess? It's only for one page.
Thanks.
Rewriting my comment as an answer...
Looks like the URL doesn't matter. It's the value of disqus_url that uniquely identifies that page. You should be able to set that reliably.
From the documentation...
disqus_url
Tells the Disqus service the URL of the current page. If undefined,
Disqus will take the window.location.href. This URL is used to look up
or create a thread if disqus_identifier is undefined. In addition,
this URL is always saved when a thread is being created so that Disqus
knows what page a thread belongs to.
While the window.location.href is used in absence of disqus_url, we
highly recommend defining this variable. If a user visits your page at
the URL http://example.com/helloworld.html?123, Disqus may in fact
load a different thread than if the user came from
http://example.com/helloworld.html.
To make sure the right thread is always displayed, you should define
on your page, using an absolute URL, var disqus_url =
'http://example.com/helloworld.html';

How to retrieve page with special characters in page name

Trying to retrieve general page info using the Facebook graph API using an Jquery/Ajax call. This works flawlessly until I request a page containing special characters or dashes in it's name.
It seems like the special characters are ANSI encoded during the ajax request so the name is malformed and the page cannot be found. I can't find a way though to obviate this.
Example url: https://graph.facebook.com/Musée-de-la-Photographie-Charleroi?access_token=[my_access_token]
Can anybody help me out?
I think you should test different values in contentType parameter. It allows to set char encoding.
Take a look here:
http://api.jquery.com/jQuery.ajax/
It seems like the special characters are ANSI encoded during the ajax request so the name is malformed and the page cannot be found.
No, I don’t think that’s the problem.
As you can see from https://developers.facebook.com/tools/explorer?method=GET&path=18521449287, this page does not have a username set yet – and since it is not accessible via just www.facebook.com/Musée-de-la-Photographie-Charleroi, but only via www.facebook.com/pages/Musée-de-la-Photographie-Charleroi/18521449287 including the page id.
And accordingly, info about the page on the Graph API is only available via the page id as well.
Try using the page_id instead (in this case 131141113604635).
https://graph.facebook.com/131141113604635?access_token=[my_access_token]
You may get this id by opening the page on the browser and pressing Ctrl+U, Ctrl+F and searching for a 'page_id' value.

Cannot use named anchors with Facebook tab link

I'm attempting to put a named anchor on a part of our Facebook tab and add "#anchor" to the shared URL so when users click the shared link it will take them directly to the proper content on the tab.
I added to my tab and then recoded the FB Feed Dialog URL so
link=http://www.facebook.com/mybhg?sk=app_279723102083145#quiz
and
actions={name:'name',link:'http://www.facebook.com/mybhg?sk=app_279723102083145#quiz'}
In testing the dialog displayed an error saying both of these were invalid links:
Requires valid redirect URI
actions should be a JSON-encoded dictionary with "name" and "link" keys
So I bit.ly'd them which Facebook accepted and you can share the short URL. When users click the shared link though, the correct URL is used (with "#quiz") but the browser does not snap to the anchor location.
Since FB failed on the original URL, I suspect they aren't set up to parse #named anchors in their URLs, but I wanted to put it out to the community and see if someone has made it work (or confirmed it doesn't.)
Thanks!
URL fragments (the #) can't be read on the server side.
What you can do is use the app_data parameter, which is forwarded to you on the signed_request parameter, parse it accordingly, and have some Javascript to force the jump yourself.

How best to setup 301 redirects from an old site that has many duplicate entries indexed on Google?

I am currently working with a client to redevelop their website. One of the final things I need to do before launch, is to make sure that their old website's pages are correctly redirected to the new URL structure of the new website.
Unfortunately, when I check Google to see how their current site is indexed, this relatively small website appears to have over 1500 pages indexed.
When I look at the indexed links on Google, many appear to be duplicates of the same page, but because of the terrible URI structure used on the old website, Google treats them differently.
For example, the 'Map' page is indexed at least twice on Google, under the following 2 URLs:
www.website.com/frame_page-map.html?mp_session=iris7k85851j05q55piqci31u3&mp_session=iris7k85851j05q55piqci31u3?page_code=map&mp_session=iris7k85851j05q55piqci31u3&mp_session=iris7k85851j05q55piqci31u3
www.website.com/frame_page-map.html?mp_session=sel6m8j5cu8lulep4dqa32sne7&mp_session=sel6m8j5cu8lulep4dqa32sne7?page_code=map&mp_session=sel6m8j5cu8lulep4dqa32sne7&mp_session=sel6m8j5cu8lulep4dqa32sne7
Only the session name is different in the URL (and I have no idea why it is repeated four times in a single URL, either).
For reference, the replacement URL for this page is:
www.website.com/contact/map
My question is: How do I setup a redirect for these multiple records on Google? Do I simply set-up the redirect for the old URL minus all of the URI parameters (i.e. www.website.com/frame_page-map.html) or is there another better method to do this?
Thanks for any help you might be able to offer!
It depends on what your goals are. If you don't care about the querystrings then setup a 301 (permanent redirect) that points to just your root page - map.html. To prevent google from indexing querystring params as separate pages use the canonical tag and have it reference the parent. This isn't guaranteed to work, but google takes your canonical into consideration when indexing.
If you care about the querystring values then you will have to setup a redirect for each one. There is a querystring parameter that you can append to your redirects that will tell it to be ignored so you don't have to write a regex that detects it.

Facebook Connect response ignoring 'next' parameter

I'm using the Facebook connect login API for desktop apps presented here:
http://wiki.developers.facebook.com/index.php/Authorization_and_Authentication_for_Desktop_Applications
I'm finding that the parameters I pass arent working correctly. Here's an example of the URL I use for the site:
http://www.facebook.com/login.php?api_key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&connect_display=popup&v=1.0&next=http://www.facebook.com/connect/login_success.html&cancel_url=http://www.facebook.com&fbconnect=true&return_session=true&req_perms=publish_stream
If the user logs in correctly, they are redirected to
http://www.facebook.com/
instead of the value in the next parameter. This is particularly frustrating since the url of the site they were redirected to is supposed to contain login information.
Amazingly, the cancel_ url parameter works fine and sends the user to the correct target (I tried multiple cancel_url values inside of the facebook.com domain and they worked). Anybody dealt with this?
Is the API Key valid? Is your callback url set correctly in the application ? the next parameter is seeming to be ignored on non Internet Explorer Browsers.
Actually the next parameter was messing up the code in IE, so i removed the next parameter. What I did is storing the redirect back url in session and used a file to handle all facebook logins in all my domains.
http://digitalpbk.blogspot.com/2009/08/facebook-auth-next-parameter-ie.html