External JS usage in FBML - Cannot access external script

Posted by santhakr on Stack Overflow See other posts from Stack Overflow or by santhakr
Published on 2010-04-27T23:52:26Z Indexed on 2010/04/28 0:13 UTC
Read the original article Hit count: 1245

Filed under:
|
|
|

Hi, I am trying to create a small facebook app and associate it to a fan page in a tab. I am trying to include an external javascript file in my page and call a method on a button click event.

Below is a part of the code

<script language="Javascript" src="http://mysite.com/fb.js"></script>
<input type="button" value="Click....." onClick="javascript:showDialog();" />

content of fb.js is as below

function showDialog() {
    new Dialog().showMessage('Dialog', 'Button clickeed');
}

When I load the tab in my fan page, it shows an error "Cannot allow external script", whereas when I load the canvas url [http://apps.facebook.com/...] directly and click on the button, it works [shows the dialog].

Does script include works only on the canvas and not on the profile page?

I have another question though Initially I had the script src as a relative path but it errored out with the same error - "Cannot allow external script". Can't I use relative path for the external scripts?

© Stack Overflow or respective owner

Related posts about fbml

Related posts about facebook