Skip to content

Instantly share code, notes, and snippets.

@sdsykes
Created April 6, 2011 06:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdsykes/905227 to your computer and use it in GitHub Desktop.
Save sdsykes/905227 to your computer and use it in GitHub Desktop.
Jumploader javascript to set csrf token
<script>
function appletInitialized(applet) {
setTimeout("set_applet_csrf()", 1000);
}
function set_applet_csrf() {
var name = "<%= request_forgery_protection_token %>";
var value = "<%= form_authenticity_token %>";
set_upload_param(name, value);
}
function set_upload_param(name, value) {
var uploader = document.jumpLoaderApplet.getUploader();
var attrSet = uploader.getAttributeSet();
var attr = attrSet.createStringAttribute(name, value);
attr.setSendToServer(true);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment