Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
687 views
in Technique[技术] by (71.8m points)

php - What can cause a double page request?

I am currently investigating a double request problem on my site. Not all the time, but sometimes, a requested page will in fact load twice...which is not a problem really until it is on a page with PHP that inserts stuff into my db on request (my tracking script).

I have read that an empty src in an image tag, and an empty url() in a css background could potentially cause the page to be requested twice.

However, I can't find any problems with those.

Is there anything else that could be causing something like this?

ANSWER FOR MY SITUATION

After some extensive research, it turns out that in my case specifically, the second request has been coming from the user agent "Mediapartner-Google". I began to notice that on pages that serve an Adsense ad, I could expect a secondary visit from this crawler within seconds after I visit the page myself.

This doesn't seem to be happening on pages without Adsense ads.

I am going to mark an answer below, because it seems like for most situations, those are the correct things to check.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I have sat beside people whom I would swear knew better than this, and watch aghast as they double-clicked on every hyperlink in our app.

Didn't take long to figure out why they were experiencing double the page load time of everyone else...

Things like this certainly tend to give one pause when implementing pages that change the backend state. A lot of people put sequence numbers in hidden form elements so the backend can detect a double-submit.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...