开发者

How to use external JavaScript file in Facebook application development?

How can I use the external JavaScript in F开发者_开发知识库acebook 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜