0

How do I get the URL fragment (hash) from a Facebook application URL passed on t...

 2 years ago
source link: https://www.codesd.com/item/how-do-i-get-the-url-fragment-hash-from-a-facebook-application-url-passed-on-the-application-s-canvas.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How do I get the URL fragment (hash) from a Facebook application URL passed on the application's canvas?

advertisements

I'm coding a "one page" app inside facebook (using the canvas app approach). While the user moves inside the app I'm changing the location like: apps.facebook.com/my-app#current_location and loading stuff via AJAX.

Unfortunetely, when someone loads http://apps.facebook.com/my-app#current_location in their browser, the canvas app doesn't see the url fragment #currrent_page.

How can I get around this limitation?


Although I cannot answer properly your question, (and as I think it's kind of old already) the info below should help other people understand better these # (hash) things. They are called URL Fragments.

http://blog.httpwatch.com/2011/03/01/6-things-you-should-know-about-fragment-urls/

Any URL that contains a # character is a fragment URL. The portion of the URL to the left of the # identifies a resource that can be downloaded by a browser and the portion on the right, known as the fragment identifier, specifies a location within the resource:

07xu9.png

Fragments Are not Sent in HTTP Request Messages

If you try using fragment URLs in an HTTP sniffer like HttpWatch, you’ll never see the fragment IDs in the requested URL or Referer header. The reason is that the fragment identifier is only used by the browser – it doesn’t affect which resource is returned from the server.Here’s a screen shot of HttpWatch showing the traffic generated by refreshing a fragment URL:

FOKj8.png

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK