facebook example change to use javascript