X
Tap here to go to the mobile version of the site.

Support Forum

video set to autoplay causes hit counter to double count

Posted

on my website i have a video set to play immediately (set to autostart). but for some reason, when viewing in FF, this makes my .php hit counter increment by 2 (or sometimes even 4).

on other pages that have videos that are played manually, the hit counter works fine. but if i add autoplay video, the counter goofs up.

chrome doesn't have this problem on any pages, nor does IE. i have reset FF to factory. v13.0.1

on my website i have a video set to play immediately (set to autostart). but for some reason, when viewing in FF, this makes my .php hit counter increment by 2 (or sometimes even 4). on other pages that have videos that are played manually, the hit counter works fine. but if i add autoplay video, the counter goofs up. chrome doesn't have this problem on any pages, nor does IE. i have reset FF to factory. v13.0.1

Chosen solution

No, I mean change your PHP so that if there is no actual separate poster image, you do not include the poster attribute at all. It isn't necessary if you want the first frame of the video displayed. See: https://developer.mozilla.org/en/HTML/Element/video

Read this answer in context 0

Additional System Details

This happened

Every time Firefox opened

This started when...

as soon as i added a hit counter

Application

  • User Agent: Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20100101 Firefox/13.0.1

More Information

jscher2000
  • Top 10 Contributor
8690 solutions 71033 answers

Can you post a link to a page that demonstrates this behavior?

Can you post a link to a page that demonstrates this behavior?

Question owner

glad to. dragonartstore.com/test
jscher2000
  • Top 10 Contributor
8690 solutions 71033 answers

In your page, you have this (line breaks added for readability):


<video height="170" preload="auto" autoplay="autoplay" poster "*.*">

Firefox interprets that as follows (select page > right-click > View Selection Source):


<video tabindex="0" preload="auto" autoplay="autoplay" poster="" "*.*"="" height="170">

As you can see, Firefox sets poster="" which you probably had no idea causes Firefox to retrieve the page itself as the image. I'm not sure what Firefox is doing with the "*.*" but again it appears to be interpreting it as something that takes a URL and is again retrieving the page.

Can you fix this tag in your PHP?

That add up to 3 page retrievals. I think I've left one unaccounted for, but maybe fixing this will take care of that one as well.

In your page, you have this (line breaks added for readability): <br>&lt;video height="170" preload="auto" autoplay="autoplay" poster "*.*"> Firefox interprets that as follows (select page > right-click > View Selection Source): <br>&lt;video tabindex="0" preload="auto" autoplay="autoplay" poster="" "*.*"="" height="170"> As you can see, Firefox sets poster="" which you probably had no idea causes Firefox to retrieve the page itself as the image. I'm not sure what Firefox is doing with the "*.*" but again it appears to be interpreting it as something that takes a URL and is again retrieving the page. Can you fix this tag in your PHP? That add up to 3 page retrievals. I think I've left one unaccounted for, but maybe fixing this will take care of that one as well.

Question owner

j - when you say "fix", do you mean change the poster "." to poster "" ? if so, i just tried it and got the same behavior.

j - when you say "fix", do you mean change the poster "." to poster "" ? if so, i just tried it and got the same behavior.
jscher2000
  • Top 10 Contributor
8690 solutions 71033 answers

Chosen Solution

No, I mean change your PHP so that if there is no actual separate poster image, you do not include the poster attribute at all. It isn't necessary if you want the first frame of the video displayed. See: https://developer.mozilla.org/en/HTML/Element/video

No, I mean change your PHP so that if there is no actual separate poster image, you do not include the poster attribute at all. It isn't necessary if you want the first frame of the video displayed. See: https://developer.mozilla.org/en/HTML/Element/video

Question owner

hey, that seemed to work.

sometime back, when i was first learning html5 (only about 4 months ago), i discovered that using poster "." did something very neat, and i was proud that i had discovered the trick. but now i don't remember what it was.

your explanation makes a lot of sense.

i am appreciative.

being that this was my first post, i will ask a dumb question. if for some reason it starts to goof up again, is there a way i can ask you directly ?

hey, that seemed to work. sometime back, when i was first learning html5 (only about 4 months ago), i discovered that using poster "." did something very neat, and i was proud that i had discovered the trick. but now i don't remember what it was. your explanation makes a lot of sense. i am appreciative. being that this was my first post, i will ask a dumb question. if for some reason it starts to goof up again, is there a way i can ask you directly ?
jscher2000
  • Top 10 Contributor
8690 solutions 71033 answers

I generally check this site every day, but if you really need to contact me directly, I'm pretty easy to track down in Google. ;-)

I generally check this site every day, but if you really need to contact me directly, I'm pretty easy to track down in Google. ;-)

Question owner

ok. thanks again.

ok. thanks again.
jscher2000
  • Top 10 Contributor
8690 solutions 71033 answers

One other thing to look at is specifying your character encoding in an HTTP header sent before Firefox actually starts parsing the document. This has been reported as an issue in some shopping cart applications: failure to do this can cause Firefox to re-request (re-submit a request) when it comes to the meta tag specifying the character set.

You can try this at the top of your file with any other headers you are setting:


<?php header('Content-type: text/html; charset=utf-8'); ?>

If I've remembered that incorrectly, you can get the precise syntax by searching around.

One other thing to look at is specifying your character encoding in an HTTP header sent before Firefox actually starts parsing the document. This has been reported as an issue in some shopping cart applications: failure to do this can cause Firefox to re-request (re-submit a request) when it comes to the meta tag specifying the character set. You can try this at the top of your file with any other headers you are setting: <br>&lt;?php header('Content-type: text/html; charset=utf-8'); ?> If I've remembered that incorrectly, you can get the precise syntax by searching around.

Question owner

ok. i will try and find the exact text. that advice is very much appreciated.

ok. i will try and find the exact text. that advice is very much appreciated.

Question owner

12345

12345

Modified by pat500

Question owner

12345

12345

Modified by pat500

Question owner

j - i have read your suggestion several times, and i can't say that i completely understand it. "specifying your character encoding in an HTTP header sent before Firefox actually starts parsing the document. This has been reported as an issue in some shopping cart applications: failure to do this can cause Firefox to re-request (re-submit a request) when it comes to the meta tag specifying the character set. "

i can't tell from these words whether it should be done or not (this has been reported as an issue & failure to do so ...).

this is what is currently at the top of my page :

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>DRAGON ART STORE - Home Page</title>
if i understand you correctly, it would be better like this :

<!DOCTYPE html>
<html lang="en">
<?php
header('Content-type: text/html; charset=utf-8');
?>
<head>
<title>DRAGON ART STORE - Home Page</title>

is that what you had in mind ?

j - i have read your suggestion several times, and i can't say that i completely understand it. "specifying your character encoding in an HTTP header sent before Firefox actually starts parsing the document. This has been reported as an issue in some shopping cart applications: failure to do this can cause Firefox to re-request (re-submit a request) when it comes to the meta tag specifying the character set. " i can't tell from these words whether it should be done or not (this has been reported as an issue & failure to do so ...). this is what is currently at the top of my page : &lt!DOCTYPE html&gt<br/> &lthtml lang="en"&gt<br/> &lthead&gt<br/> <meta charset="UTF-8"><br/> <title>DRAGON ART STORE - Home Page</title> <br/> if i understand you correctly, it would be better like this : &lt!DOCTYPE html&gt<br/> &lthtml lang="en"&gt<br/> &lt?php<br/> header('Content-type: text/html; charset=utf-8');<br/> ?&gt<br/> <head><br/> <title>DRAGON ART STORE - Home Page</title> is that what you had in mind ?

Modified by pat500

Question owner

12345

12345

Modified by pat500

jscher2000
  • Top 10 Contributor
8690 solutions 71033 answers

Sorry, I assumed your site is PHP-based; if you are using a content management system or another publishing platform, or JSP or ASP, then there would be a different way to do this.

The PHP code should be the first first three lines on the document. It generates a header that is sent to the browser ahead of the page and is not part of the page that you can see in the browser.

Sorry, I assumed your site is PHP-based; if you are using a content management system or another publishing platform, or JSP or ASP, then there would be a different way to do this. The PHP code should be the first first three lines on the document. It generates a header that is sent to the browser ahead of the page and is not part of the page that you can see in the browser.

Question owner

my site was originally sitename.html, but i had to change it to sitename.php in order to get the PHP hit counter to work. but i am not sure if that makes it PHP-based.

is this what you have in mind ?

<?php
header('Content-type: text/html; charset=utf-8');
?>
<!DOCTYPE html>
<html lang="en">

<head>
<title>DRAGON ART STORE - Home Page</title>

my site was originally sitename.html, but i had to change it to sitename.php in order to get the PHP hit counter to work. but i am not sure if that makes it PHP-based. is this what you have in mind ? &lt?php<br/> header('Content-type: text/html; charset=utf-8');<br/> ?&gt<br/> &lt!DOCTYPE html&gt<br/> &lthtml lang="en"&gt<br/> <head><br/> <title>DRAGON ART STORE - Home Page</title>
jscher2000
  • Top 10 Contributor
8690 solutions 71033 answers

Yes, that should work.

Yes, that should work.

Question owner

hmm. i got this error message at the top. i don't know what it means. would you have a look ?

att

hmm. i got this error message at the top. i don't know what it means. would you have a look ? att
jscher2000
  • Top 10 Contributor
8690 solutions 71033 answers

Hi pat500, it means that the way your server is configured, you can't add the header I suggested adding. Sorry! You could contact your host and request that they add it to your server's configuration files so it is sent automatically. But since this is only to try to avoid problems with the hit counter, I'm not sure it's worth paying for support for that.

Hi pat500, it means that the way your server is configured, you can't add the header I suggested adding. Sorry! You could contact your host and request that they add it to your server's configuration files so it is sent automatically. But since this is only to try to avoid problems with the hit counter, I'm not sure it's worth paying for support for that.