Page 1 of 1

gcount doesn't work with the onplaying attribute of video

Posted: Mon Jun 11, 2018 2:58 pm
by Jim Weinberg
Script URL: http://michiganbuttonsociety.org/Script ... gcount.php
Version of script: 1.3.1
Hosting company: Site5
URL of phpinfo.php: http://michiganbuttonsociety.org/Script ... geinfo.php
URL of session_test.php: http://michiganbuttonsociety.org/Script ... n_test.php
What terms did you try when SEARCHING for a solution: gcount, video

Write your message below:
I've used gcount in several applications and it's always worked fine. Until I tried to use it as the argument of the onplaying attribute of the video tag:
<video width="770" controls onplaying="http://www.michiganbuttonsociety.org/Sc ... rviewVideo">.

The video plays, but the text file does not update.

Any suggestions?

Thanks.
Jim W.

Re: gcount doesn't work with the onplaying attribute of video

Posted: Mon Jun 11, 2018 6:25 pm
by Klemen
The onplaying attribute won't load external pages, it can for example just run some Javascript.

You will need to use something else:

1. load the counter on the page instead of the video attribute. If you don't want to show the count you place the code in a hidden div for example.

- or -

2. create a Javascript function that will load the URL asynchronous and run the function in the onplyaing attribute.

Re: gcount doesn't work with the onplaying attribute of video

Posted: Fri Jun 15, 2018 1:48 pm
by Jim Weinberg
Hi Klemen. Thanks for the response. I've actually tried that using the following script:

function getCount(){
message = '<img src="http://www.michiganbuttonsociety.org/Sc ... rviewVideo" style="display:none;">'
document.write(message);
return true;
}

and calling it from the video tag: <video width="770" controls onplaying="getCount()">

As soon as the video starts, the browser goes to a blank page.

Jim W.