gcount doesn't work with the onplaying attribute of video

In case you have problems with some other PHPJunkyard script (not that there are THAT many).
Post Reply
Jim Weinberg
Posts: 2
Joined: Sun May 13, 2018 6:50 pm

gcount doesn't work with the onplaying attribute of video

Post 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.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

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

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Jim Weinberg
Posts: 2
Joined: Sun May 13, 2018 6:50 pm

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

Post 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.
Post Reply