crp

Hosting Js Libs On Amazon S3

Recommended Posts

Hi there,

 

I'm trying to host the static javascript libraries on Amazon S3 and am encountering some issues with the autoloading. Here is the issue.

 

When we include the main FusionCharts.js, the script attempts to load the file FusionCharts.HC.js but the path to FusionCharts.HC.js is incorrect resulting in a 404. For example, we load the main FusionCharts.js from our S3 bucket like this:

 

<script type="text/javascript" language="javascript" src="http://assets.mydomain.org/js/FusionCharts.js"></script>

 

This should be autoloading the following file

 

<script type="text/javascript" language="javascript" src="http://assets.mydomain.org/js/FusionCharts.HC.js"></script>

 

But instead attempts to load

 

<script type="text/javascript" language="javascript" src="http://www.mydomain.org/page/http%3A%2F%2Fassets.mydomain.org%2Fjs%2FFusionCharts.HC.js "></script>

 

Which obviously is malformed and does not exist (results in 404). I've peaked in the obfuscated FusionCharts.js and the error arises around line 36 where the construction of the path to the autoloaded library is created. I can't figure out a fix though as I'm not a javascript wiz. Any help would be much appreciated!

 

By the way, I'm using version 3.2.2-servicerelease1.4200

Share this post


Link to post
Share on other sites

Hi,

 

I have this exact same issue. Specifically:

- I have my FusionCharts files in an S3 bucket and load with a call like

<script src="https://s3-eu-west-1.amazonaws.com/domain/html/charts/FusionCharts.js" type="text/javascript"></script>

 

This loads correctly, however the auto-loader is trying to load FusionCharts.HC.js at

http://www.domain.com/client/https://s3-eu-west-1.amazonaws.com/domain/html/charts/FusionCharts.HC.js'>http://www.domain.com/client/https://s3-eu-west-1.amazonaws.com/domain/html/charts/FusionCharts.HC.js

 

Which, as the previous poster mentioned, is an invalid domain.

 

My script is at http://www.domain.com and my FC files at https://s3-eu-west-1.amazonaws.com/domain/html/charts so I don't see how I can create a relative path for the js files.

 

Am I missing something / is there a workaround?

 

Thanks,

 

Charles.

Share this post


Link to post
Share on other sites

Hi Charles,

 

Can you please try loading all the JavaScript files explicitly?

 

Ref. code:(Please add the files as below)

<script language="JavaScript" src="https://s3-eu-west-1.amazonaws.com/domain/html/charts/jquery.min.js"></script>'>https://s3-eu-west-1.amazonaws.com/domain/html/charts/jquery.min.js"></script>

<script language="JavaScript" src="https://s3-eu-west-1.amazonaws.com/domain/html/charts/ FusionCharts.js"></script>

<script language="JavaScript" src="https://s3-eu-west-1.amazonaws.com/domain/html/charts/FusionCharts.HC.js"></script>

<script language="JavaScript" src="https://s3-eu-west-1.amazonaws.com/domain/html/charts/FusionCharts.HC.Charts.js"></script>

 

Hope this helps.

Share this post


Link to post
Share on other sites

Hi Charles,

 

Can you please try loading all the JavaScript files explicitly?

 

Ref. code:(Please add the files as below)

<script language="JavaScript" src="https://s3-eu-west-1.amazonaws.com/domain/html/charts/jquery.min.js"></script>'>https://s3-eu-west-1.amazonaws.com/domain/html/charts/jquery.min.js"></script>

<script language="JavaScript" src="https://s3-eu-west-1.amazonaws.com/domain/html/charts/ FusionCharts.js"></script>

<script language="JavaScript" src="https://s3-eu-west-1.amazonaws.com/domain/html/charts/FusionCharts.HC.js"></script>

<script language="JavaScript" src="https://s3-eu-west-1.amazonaws.com/domain/html/charts/FusionCharts.HC.Charts.js"></script>

 

Hope this helps.

 

You are a star! That's cracked it.

 

FYI, I also had to add the link to /FusionCharts.jqueryplugin.js.

 

Many thanks,

 

Charles.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now