This might sound like a silly question, but yesterday none of our sites would load. After contacting the hosting company they said that
In this instance, it would appear that your site is hanging waiting for a response from an external component / website (looking at your code, I see references to Facebook, Google and online apps at a glance).
We've never had this problem before and the sites have been using the social plugins for months so I wondered if anybody else experienced this problem yesterday?
Thanks
Without knowing the details, I can tell you that when you load Javascript via <script></script> tags the browser waits for the request to finish before moving on. So, if you load JS files in the <head></head> section, nothing will render on-screen until they load successfully. 404s here will kill you, as will slow connections.
If you have in-line JS, it's best to put it at the very bottom of your <body></body> section so that it does not interrupt browser rendering. Do this for JS files in your <head></head> section if your code architecture allows it.
Just a random stab in the dark but I wonder if this was related in any way to the anonymous threats on Facebook. I have experienced similar problems before with a twitter plugin, it could take a few seconds for the plugin to ping back the tweets and the rest of the page was hanging while twitter was doing their thing.
To ensure this doesn't happen again you could call your social plugin's on page load if its a viable solution. At the end of the day do you want your page load time to depend on other services outside of your control or not?
edit: #Jason McClellan 's answer is spot on. I believe the combo of out answers sort out your question. I Never include script in the head if I don't control the resource! That can indefinitely hang your page.
edit2: Don't know why I'm getting down rated for this answer was just trying to relate it to an experience of mine. I'm not extremely experienced with Facebook plugins but when I was noticing an issue with my twitter plugin, I did exactly what #Jason McClellan has said with his answer to make sure that all your html gets rendered before the scripts are even requested, then ensured that the page could display correctly with or without the twitter content so the user experience was not dependant on an external resource. The twitter plugin I was using had an initiation function which I had to call to fire up the script. The simplest way to call this would be with:
<body onload='init()'>
if you have another script you are loading with the page you could use something along the lines of
window.onload = function() {
init();
}
from within your external script.
Sorry I can't give an answer specific to the Facebook plugin. Maybe someone with more experience in the Facebook plugins could elaborate in the comments :D
edit3: also this community based tool suggests that quiet a few people where seeing a bit of facebook downtime when you experienced it - Facebook status at DownRightNow
edit4: I dont have the "Privelages" to comment on Jason's q as im pretty new here ... but in answer to your comment there, the stuff in the head that you describe is what loads in the schema for facebook mark-up language (fbml) , so a mark-up language like html, but geared up for you to use the facebook api. So you can do stuff like:
<fb:comments xid="titans_comments" canpost="true" candelete="false" returnurl="http://apps.facebook.com/myapp/titans/">
<fb:title>Talk about the Titans</fb:title>
</fb:comments>
To wack some comments straight into your page - fbml developers guide
Your comment there also suggests you are not including a script for your page to load so it renders our previous answers not as important, you need to include the fbml stuff in the head before you use fbml in your page so don't move it :D
but #jason McClellan's answer is something that everyone should do on their project (unless there is a reason not to) as it allows for the user to see something before the browser fires off requests for the scripts. At the end of the day we're in this game to make pretty stuff for our users!
Good luck
Related
I am going insane with this. It used to just work! I'm a programmer but not up to date with all this modern languages stuff and have no desire to learn it - too darn old, just want an easy life.
Okay, so here's the thing... I used to have these "like boxes" on my websites. Then they stopped working. I looked in the dev docs and fixed the absolute URL and they worked ok on IE browsers but not on Chrome.
It looks like I need an App Id.
So I created an App Id on a test website - I have no idea what it is or why I need one. All I want to do is show on the website it has n likes and the button for Facebook lovers to like it too.
But do I need to create an App Id for every single clients website? How do other CMS systems handle it? My sites are not html 5 - I'd be happy with just an iframe solution.
I'm not a fan of Facebook at all, and this is driving me further away. I'm willing to be dragged back but all I see is lots of overly complex code to achieve nothing really useful.
You can do whatever you want with your app ID, but if you use the same one for all your sites, you won't be able to separate those in your "Insights"
https://www.facebook.com/insights/
How do you implement custom css on a Facebook activity feed plugin? This related post does not fully answer the question. Is this the right way?
Where does the
<fb:tag name='link'></fb:tag>
go? Inside of of the
<fb:activity site="..." app_id="..." ></fb:activity>
outside of it, before or after? I'm sort of confused...
the only way i use activity feed is when its in a widget that will generically upate in all posts. Anyone who inserts these snippets into blog posts or other 'hard to find and edit later' posts and pages, will regret it
Why?
Because Facebook changes their script every month or so and the script snippet you inserted wont work anymore
I have hundreds of blank areas in blog posts where i inserted an activity feed and the script always stops working after some weeks when fb adds some code or changes the location of some script or renames a file and the old script has no canonical or generic way of readjusting.
There is no point in using a script which gets made obsolete every month and you then need to find all posts where you inserted the snippet and change it for the new working code.
Im always having to reinsert new code into my fb social widgets because they cease to function...
Not viable unless you take it into consideration. Only insert in spaces where oyu wil notice it when it stops working
As Facebook Answers answered, you cannot really style it with a custom CSS, nor via JS, as the activity feed widget creates an iframe.
The info from martincarlin87 is useful, but that is not exactly what you get with the Activity Plugin, which is what you meant I guess:
http://developers.facebook.com/docs/reference/plugins/activity/
For using this you cannot really interact with the Facebook API, it is a little world apart. By now... (July 12th 2012)
Facebook PHP SDK: https://github.com/facebook/php-sdk
Comes with some simple examples, I would suggest uploading it to your server and tinkering with it, Facebook has a steep learning curve but here at Stack Overflow there is even a Facebook section: facebook.stackoverflow.com so just take each step at a time and if you can't get it by reading the facebook docs: developers.facebook.com then you can always ask here and I'm sure someone will be able to help you.
Getting Started: http://developers.facebook.com/docs/reference/php/
Once you have made an app, you add it to your fan page and then you will be abel to test what information you can get using the Graph API Explorer: https://developers.facebook.com/tools/explorer
That post you refer to is a red herring I'm afraid. If you put any HTML between the activity tags it gets rendered BEFORE the iframe is added. So its a no starter, from what I can see. However, I eventually found a solution, which I gave on that thread. I am repeating it here in case somebody searching doesn't see the other thread.
I managed to customise an Activity plugin, after a great deal of effort.
You can see the result here:
http://www.quniverse.co.uk/shopdata/about_us.php
Feel free to post a comment on that site, it exists purely for test purposes so I'm not fussed what goes up there provided its clean.
I explain how I achieved this in the blog article posted here:
http://facebookanswers.co.uk/?p=302
To summarise briefly:
You cannot insert CSS into the activity plugin.
Rely on the fact it has a transparent background, and supply your own.
Turn off the header and supply your own.
You can specify a light or a dark font, a few fontfaces and a border colour.
If you read the blog article you will get a full explanation.
Sorry for this basic question but all attempts at Googling and using facebook help only provide out of date information.
I am attempting to make my first fb app. Just an html page saying hello. From what I understand the app (or webpage) is stored on my server and I set up a facebook app that basically points to the URL of the app (or webpage) on my server.
Is this basically correct.
Where do I enter this URL information in my edit app screen. I have followed the latest fb instructions and all I see when I view the app is the admin page in fb for the app.
Does it take a long time for the page to appear.
Is there a current idiots guide. The app design is not a problem for me loading it in to facebook is the problem.
Unfortunately this wasn't very helpful, not because of what you posted but due to the fact that it appears that Facebook has updated the way in which pages are linked to again.
The pages you suggested I look at were well laid out with lots of information on them but they are already out of date and do not seem to correspond with the layout of the Facebook 'dev app' and even the fields in the form seem to have been either dropped added to renamed.
Thanks for trying to help me and I hope that FB may produce some up to date information soon and not keep changing the interface.
I can completely understand your confusion - the Facebook docs give very little information for the complete beginner. The 'Getting Started' section makes some massive assumptions and completely ignores huge key areas you need to know to get your first application up and running.
So to address your points:
Yes, this is basically correct. Apps on Facebook are served up to the user in one of two ways. Either as a 'Canvas App' or a 'Tab App'. A Tab App is an application you can install as a tab on a profile page. A Canvas App can operate on it's own page and has more room as there's no left menu as you would have on a profile page. You can configure a single app to work in both ways.
To edit your application settings, go to your own Facebook home page. Use the search bar to search for the 'Developer App'. Typing in 'developer' should do it - it should be the first result in the App section with around 830,000 monthly users. This Developer app is the window into your own app settings. You need to install it if you haven't already. It's a hub where all the apps you create will be available for you to edit. Whenever you want to edit one of your app settings in future, you click the Developer bookmark that will now be in the left menu on your own Facebook home page.
No. Apps are basically an iframe onto your code. There should be very little if any wait at all. Start with something very simple like spitting out some straight html so you can easily tell if things are set up correctly.
Yes. I found thinkdiff.net to be massively useful in the early days to get my head round the basics and then more advanced concepts. There's tons of examples ranging from very simple to quite advanced. I've just had a quick look around and found this page which should give you a decent head start in getting things moving. Note: I have no affiliation with thinkdiff.net at all - I just found them helpful in the past.
Finally, a request from me; this whole stack overflow thing is new for Facebook developers and very few people are voting up answers they consider helpful. This means new users to SO but experienced FB developers can't vote up good answers and vote down bad ones as we need enough Reputation Points to do so. If this has helped you, please ensure you vote up the answer. Of course if it was rubbish and you're just as lost, dont :D
Hope I've helped in some small way; I know I was completely lost for the first few weeks with FB development and even now there are things that make me tear my hair out! In the end it's very rewarding, but you have to put in the time. Good luck :)
I need help with a problem I'm facing, basically I'm utilizing the new "Facebook Comment Box" feature and the issue is it is overlaying with standard Wordpress comments. It is best described by showing you the following screenshot:
Because I'm new here I couldn't post a screenshot because I don't have enough rep so a link to the screenshot of the problem is here - http://www.wdbc.org.au/comment_screenshot.jpg
The true URL for the above screenshot is here
So I did some investigating around, I couldn't find anyone else who came across this problem, but I also found that it is a combination of factors which makes encountering it more rare. Below are some specifics on what I'm using, and factors I believe are contributing to this problem:
Wordpress 3.1
Wordpress Theme Genesis1.5
Wordpress Plugin Facebook Comments for WordPress 3.1
Wordpress Plugin The Events Calendar 1.6.5
Google Chrome Browser 10.0.648.204
Some important notes on this problem:
It does not happen for the same URL in Explorer or Firefox, only in Chrome
It only happens in Wordpress posts tagged as Events so the events calendar plugin is definitely part of the issue here (for example I don't see the overlap issue on a non-event post which does not utilize the Events Calendar plugin)
My thoughts:
The plugin "The Events Calendar" has something to do with this. The plugin adds some information at the top of the post such as Date, Address, Cost, etc, and the height this information takes up seems to be about exactly the height the wordpress comment is encroaching on the space of the facebook comment section.
I don't have enough Wordpress expertise to dig deeper in to this and determine what is wrong with either the Events plugin or the Chrome browser and I'm not really sure where to start. I would really appreciate if anyone can help provide some tips or guidance on how I could progress with this issue. If you need any further details just ask and I would be happy to share, thank you.
Edit: Same problem observed in Safari (on iPhone) so impacts Chrome/Safari not Firefox/Explorer.
Edit2: On further testing it looks like this is only impacting retrospectively. I created a new Event post and it works fine, but older Event posts are affected. I guess this makes the issue not as impacting as I first thought so I might be able to live with this.
It might have something to do with the like button. I use a plugin for wordpress that also includes the like button. I chose to hide it, and all is good. I will enable the like button using another plugin.
I've just noticed that the long, convoluted Facebook URLs that we're used to now look like this:
http://www.facebook.com/example.profile#!/pages/Another-Page/123456789012345
As far as I can recall, earlier this year it was just a normal URL-fragment-like string (starting with #), without the exclamation mark. But now it's a shebang or hashbang (#!), which I've previously only seen in shell scripts and Perl scripts.
The new Twitter URLs now also feature the #! symbols. A Twitter profile URL, for example, now looks like this:
http://twitter.com/#!/BoltClock
Does #! now play some special role in URLs, like for a certain Ajax framework or something since the new Facebook and Twitter interfaces are now largely Ajaxified?
Would using this in my URLs benefit my Web application in any way?
This technique is now deprecated.
This used to tell Google how to index the page.
https://developers.google.com/webmasters/ajax-crawling/
This technique has mostly been supplanted by the ability to use the JavaScript History API that was introduced alongside HTML5. For a URL like www.example.com/ajax.html#!key=value, Google will check the URL www.example.com/ajax.html?_escaped_fragment_=key=value to fetch a non-AJAX version of the contents.
The octothorpe/number-sign/hashmark has a special significance in an URL, it normally identifies the name of a section of a document. The precise term is that the text following the hash is the anchor portion of an URL. If you use Wikipedia, you will see that most pages have a table of contents and you can jump to sections within the document with an anchor, such as:
https://en.wikipedia.org/wiki/Alan_Turing#Early_computers_and_the_Turing_test
https://en.wikipedia.org/wiki/Alan_Turing identifies the page and Early_computers_and_the_Turing_test is the anchor. The reason that Facebook and other Javascript-driven applications (like my own Wood & Stones) use anchors is that they want to make pages bookmarkable (as suggested by a comment on that answer) or support the back button without reloading the entire page from the server.
In order to support bookmarking and the back button, you need to change the URL. However, if you change the page portion (with something like window.location = 'http://raganwald.com';) to a different URL or without specifying an anchor, the browser will load the entire page from the URL. Try this in Firebug or Safari's Javascript console. Load http://minimal-github.gilesb.com/raganwald. Now in the Javascript console, type:
window.location = 'http://minimal-github.gilesb.com/raganwald';
You will see the page refresh from the server. Now type:
window.location = 'http://minimal-github.gilesb.com/raganwald#try_this';
Aha! No page refresh! Type:
window.location = 'http://minimal-github.gilesb.com/raganwald#and_this';
Still no refresh. Use the back button to see that these URLs are in the browser history. The browser notices that we are on the same page but just changing the anchor, so it doesn't reload. Thanks to this behaviour, we can have a single Javascript application that appears to the browser to be on one 'page' but to have many bookmarkable sections that respect the back button. The application must change the anchor when a user enters different 'states', and likewise if a user uses the back button or a bookmark or a link to load the application with an anchor included, the application must restore the appropriate state.
So there you have it: Anchors provide Javascript programmers with a mechanism for making bookmarkable, indexable, and back-button-friendly applications. This technique has a name: It is a Single Page Interface.
p.s. There is a fourth benefit to this technique: Loading page content through AJAX and then injecting it into the current DOM can be much faster than loading a new page. In addition to the speed increase, further tricks like loading certain portions in the background can be performed under the programmer's control.
p.p.s. Given all of that, the 'bang' or exclamation mark is a further hint to Google's web crawler that the exact same page can be loaded from the server at a slightly different URL. See Ajax Crawling. Another technique is to make each link point to a server-accessible URL and then use unobtrusive Javascript to change it into an SPI with an anchor.
Here's the key link again: The Single Page Interface Manifesto
First of all: I'm the author of the The Single Page Interface Manifesto cited by raganwald
As raganwald has explained very well, the most important aspect of the Single Page Interface (SPI) approach used in FaceBook and Twitter is the use of hash # in URLs
The character ! is added only for Google purposes, this notation is a Google "standard" for crawling web sites intensive on AJAX (in the extreme Single Page Interface web sites). When Google's crawler finds an URL with #! it knows that an alternative conventional URL exists providing the same page "state" but in this case on load time.
In spite of #! combination is very interesting for SEO, is only supported by Google (as far I know), with some JavaScript tricks you can build SPI web sites SEO compatible for any web crawler (Yahoo, Bing...).
The SPI Manifesto and demos do not use Google's format of ! in hashes, this notation could be easily added and SPI crawling could be even easier (UPDATE: now ! notation is used and remains compatible with other search engines).
Take a look to this tutorial, is an example of a simple ItsNat SPI site but you can pick some ideas for other frameworks, this example is SEO compatible for any web crawler.
The hard problem is to generate any (or selected) "AJAX page state" as plain HTML for SEO, in ItsNat is very easy and automatic, the same site is in the same time SPI or page based for SEO (or when JavaScript is disabled for accessibility). With other web frameworks you can ever follow the double site approach, one site is SPI based and another page based for SEO, for instance Twitter uses this "double site" technique.
I would be very careful if you are considering adopting this hashbang convention.
Once you hashbang, you can’t go back. This is probably the stickiest issue. Ben’s post put forward the point that when pushState is more widely adopted then we can leave hashbangs behind and return to traditional URLs. Well, fact is, you can’t. Earlier I stated that URLs are forever, they get indexed and archived and generally kept around. To add to that, cool URLs don’t change. We don’t want to disconnect ourselves from all the valuable links to our content. If you’ve implemented hashbang URLs at any point then want to change them without breaking links the only way you can do it is by running some JavaScript on the root document of your domain. Forever. It’s in no way temporary, you are stuck with it.
You really want to use pushState instead of hashbangs, because making your URLs ugly and possibly broken -- forever -- is a colossal and permanent downside to hashbangs.
To have a good follow-up about all this, Twitter - one of the pioneers of hashbang URL's and single-page-interface - admitted that the hashbang system was slow in the long run and that they have actually started reversing the decision and returning to old-school links.
Article about this is here.
I always assumed the ! just indicated that the hash fragment that followed corresponded to a URL, with ! taking the place of the site root or domain. It could be anything, in theory, but it seems the Google AJAX Crawling API likes it this way.
The hash, of course, just indicates that no real page reload is occurring, so yes, it’s for AJAX purposes. Edit: Raganwald does a lovely job explaining this in more detail.