Saving checkbox or played video code


Joined
Sep 30, 2020
Messages
3
Reaction score
0
Hi i'm looking for a piece of code that i could add to my squarespace membership page.
We have on demand videos and would like to have either a checkbox which saves once a member has viewed a video. Or a piece of code that recognises they have already watched a video and notify's them.

Is this possible?
I have coded the checkbox, but can't seem to get it to save.
see below

<input type="checkbox" name="viewed" value="viewed"> viewed
 
Ad

Advertisements

Joined
Nov 27, 2019
Messages
163
Reaction score
24
squarespace does not support PHP which would have made things simpler.
It does support Javascript.. Do you know how to use that?
I suggest JS and LocalStorage.

But check on squarespace forums to see if there is an easier way.
 
Joined
Sep 30, 2020
Messages
3
Reaction score
0
squarespace does not support PHP which would have made things simpler.
It does support Javascript.. Do you know how to use that?
I suggest JS and LocalStorage.

But check on squarespace forums to see if there is an easier way.
Thanks for the quick reply. I'm a bit of a noob on JS and local storage. The forums i haven't been able to find anything as yet.
 
Joined
Jan 22, 2020
Messages
9
Reaction score
0
<video id="video" width="480" height="400" controls="true" poster="">
<source type="video/mp4" src="video.mp4"></source>
</video>

javascript
document.getElementById('video').addEventListener('ended', function(e) {
// Your code goes here
});

jquery
$('#video').bind('ended', function() {
// Your code goes here
});

for more information follow this link
https://stackoverflow.com/questions...-watched-the-full-video-in-html5-video-player
 
Joined
Sep 30, 2020
Messages
3
Reaction score
0
<video id="video" width="480" height="400" controls="true" poster="">
<source type="video/mp4" src="video.mp4"></source>
</video>

javascript
document.getElementById('video').addEventListener('ended', function(e) {
// Your code goes here
});

jquery
$('#video').bind('ended', function() {
// Your code goes here
});

for more information follow this link
https://stackoverflow.com/questions...-watched-the-full-video-in-html5-video-player
Thanks for your reply. So if i was to add this to each video that is uploaded then each user would see that they've watched the video?
 
Ad

Advertisements

Joined
Nov 13, 2020
Messages
74
Reaction score
14
No! tysonven is using an ID in the video tag - You can only have one of these and you have a couple of video tags. And where the heavy lifting is done he has "// Your code goes here" leaving the coding up to you.
I suggest you move your site to a free provider that supports PHP. Read this and if you can do this stay on SS. If not use google to find another provider.
I used 000webhost for a number of years. Their is also AwardSpace, gigarocket, and freehosting.com
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top