Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by quidmonkey

I'm testing out leaderboard functionality using Playtomic. I created a test app, and doing the following in main.js:

	init: function() {
		Playtomic.Log.View( 427816, 'ef4a86485e514e6d', '5809802bd65d4d50b351970affe11e', document.location );
		Playtomic.Log.Play();
		for( var i = 0; i < 20; i++ ){
			var score = {
				Name: 'Player #' + i,
				Points: ( Math.random() * 1000 ).round()
			};
			Playtomic.Leaderboards.Save( score, 'highscores', this.submitComplete );
		}
    	Playtomic.Leaderboards.List( 'highscores', this.getLeaderboard, { perpage: 20 } );	
	},

	submitComplete: function( response ){
		if( response.Success ){
			ig.log( 'Successfully Logged!' );
			ig.log( response );
		}
		else{
			ig.log( 'Unable to Save High Score!' );
		}
	},

	getLeaderboard: function( scores, numscores, response ){
		if( response.Success ){
			for( var i = 0; i < scores.length; i++ ){
				this.scores.push( scores[i] );
			}
			ig.log( 'Leaderboard Retrieved!' );
			ig.log( this.scores );
		}
		else{
			ig.log( 'Unable to Retrieve Leaderboard' );
		}
	},

I'm getting this error:
Resource interpreted as Script but transferred with MIME type text/html

I checked my index.html and verified I'm including the Playtomic API properly:
<script type="text/javascript" src="http://api.playtomic.com/js/playtomic.v2.0.min.js"></script>

Any ideas?

1 decade ago by snooze

umm.. should work. I dont know playtomic, but I did a short raw request and the response header is following:

$ telnet api.playtomic.com 80
Trying 107.22.243.119...
Connected to argon-stack-1879049447.us-east-1.elb.amazonaws.com.
Escape character is '^]'.
GET /js/playtomic.v2.0.min.js HTTP/1.1
Host: api.playtomic.com

HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: public, max-age=0
Content-Type: application/javascript
Date: Sun, 20 May 2012 20:23:00 GMT
Etag: "29621-1334509863000"
Last-Modified: Sun, 15 Apr 2012 17:11:03 GMT
X-Powered-By: Express
Content-Length: 29621
Connection: keep-alive

var Playtomic={};

the Content-Type is here "application/javascript" -- it might help, if you refer to this type instead of "text/javascript" in your script tag

1 decade ago by quidmonkey

That helped. Thank you.
Page 1 of 1
« first « previous next › last »