Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Resume from last time

hy, I have this javascript code

<div id="player"></div>
<script type="text/javascript">
if (localStorage['JWPlayerPosition'] == '' || localStorage['JWPlayerPosition'] == 'undefined') {
console.log("No cookie for position found");
var currentPosition = 0;
} else {
if (localStorage['JWPlayerPosition'] == "null") {
localStorage['JWPlayerPosition'] = 0;
} else {
var currentPosition = localStorage['JWPlayerPosition'];
console.log("Position cookie found: "+localStorage['JWPlayerPosition']);

file: 'tears.mp4',

console.log('Checking position cookie!');
console.log(Math.abs(jwplayer().getDuration() - currentPosition));
if (currentPosition > 0 && Math.abs(jwplayer().getDuration() - currentPosition) > 5) {

window.onunload = function() {
localStorage['JWPlayerPosition'] = jwplayer().getPosition();

This code resume the video from the last time, this code save the data into localhost, I do like to know if there are any way to save it on a text file inside the server, if yes can you please help me ?

3 Community Answers


JW Player Support Agent  
1 rated :

We do not have built-in functionality to save cookies on the server side, but there should be a way to do this with a server side language like PHP. You could potentially use Javascript to make an AJAX request and then parse the URL parameters of that request on your server, but that is not something I have ever tried to build before, but it sounds like a fun project!


1 rated :

thank you for your answer, I never used AJAX so can you please help?
Thank you.


JW Player Support Agent  
0 rated :

This really is not the best forum on the internet to get help with making AJAX requests, but try Stack Overflow or

AJAX is usually used for requests, but you could also potentially use the AJAX request with values included as URL parameters to request a PHP file on your server. PHP could then write those values to the server.

This question has received the maximum number of answers.