[Developers] paths for referencing javascript files from client side in acre

Stefano Mazzocchi stefano at metaweb.com
Sat Jul 4 16:30:23 UTC 2009


Iain Sproat wrote:
> What's the correct path for referencing javascript files from other acre 
> apps on the client side?
> 
> I'm using acre and trying to reuse the date javascript library from the 
> freebase libraries app.  I've got the following line in my client side 
> code, <script type="text/javascript" 
> src="http://libraries.apps.freebase.dev.freebaseapps.com/date"></script>.
> But this doesn't seem to work. 

Right, this doesn't work because that file is marked as a 'script' which 
means that if called directly, acre will load it and *execute it* and 
then return you the results of that execution, which is empty since that 
script doesn't write anything to the output.

> The script can be seen 
> at http://acre.freebase.com/#app=/freebase/apps/libraries&file=date 
> <http://acre.freebase.com/#app=/freebase/apps/libraries&file=date>
> I can't use the acre.require command as it is on the server side.

I've made a copy of that file and marked it as 'file' instead of script, 
so that Acre will just send it back to you instead of executing it. Find 
it at

  http://libraries.apps.freebase.dev.freebaseapps.com/date_client_side

Hope this helps.

-- 
Stefano Mazzocchi                              Application Catalyst
Metaweb Technologies, Inc.                      stefano at metaweb.com
-------------------------------------------------------------------



More information about the Developers mailing list