How can I use the external JavaScript in Facebook application development?
Actually I want to use the Ajax tab feature in my application.
How can I use the external JavaScript in Facebook application development?
Actually I want to use the Ajax tab feature in my application.
Hai vipinsahu,
If you want to embed an external .js file, you'll have to specify the absolute path. Not only: Facebook will keep a copy of your script, even if you modify it, so you'll have to put a timestamp in the url to force a cache refresh.
For example, if you want to embed a script in your index.phtml:
<?php $this->headScript()->appendFile('http://www.yourserver.com/fbapp/scripts/js.js?v=' . filemtime('scripts/js.js')) ?>
n this way Facebook will load the script from the url: http://www.yourserver.com/fbapp/scripts/js.js?v=1231707071. When you'll edit the file, the number will change and FB will reload it.
for ref see this embed an external .js file in a facebook application