Copy link to clipboard
Copied
On a website I have a link to a movie to be played.
When the movie is over, I want to return to the previous page
Tips are desired.
Copy link to clipboard
Copied
Hello, Hjalmar_Molin,
A suggestion, if I may. What you are asking would require the user's computer to detect when the video is done playing, which JavaScript might be able to do. I am unsure.
However, what I would do is display the video in a modal, with an 'X' in the upper right corner for the user to close the modal when the video is done playing. Just my two cents.
HTH,
^ _ ^
Copy link to clipboard
Copied
Look up javascript 'onended'
Give your video an id like id="myVideo" then get a handle to the video and then execute a function to go to a page once the video has ended:
<script>
const myVideo = document.querySelector('#myVideo');
myVideo.onended = function() {
window.location.href = 'https://www.yourpagename.com';
}
</script>
Not at computer right now so cant test but l think that might work.
Although l agree with others, a return link to the previous page or modal overlay would be a better solution. Its a little bit rude to be whisked off to another location when you are not expecting it.
Copy link to clipboard
Copied
A javascript redirect will do it, using the "onended" media event, but you have to then play the video in its own page, not just a link to a mp4 file: https://www.w3schools.com/tags/ref_eventattributes.asp
Most people despise automatic rediects though, so using Wolfshade's method of displaying the video within a modal window on the original page, is a much better option.
Copy link to clipboard
Copied
In addition to what has been offered with the modal and javascript options, I have recommended in a few cases to look into the Wistia player for client's videos. They offer a unique array of integrations to allow you to embed calls to action or forms within your videos. Or you can integrate with marketing solutions or helpdesk offerings so your visitors get what they need and there's no programming involved.