Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cgi.referer disappearing

Status
Not open for further replies.

lwfg

Programmer
Feb 9, 2009
52
US
I'm losing the value of cgi.referer in 2 situations:

1. When I submit from a.cfm to b.cfm when b.cfm opens in a Javascript window.

2. When b.cfm is refreshed with a meta tag.

If I could distinguish a call from a.cfm to b.cfm from a refresh of b.cfm, it would be super helpful.
 
Referrer is a pretty unreliable thing.

I don't believe there is a referrer when a new window is open so it makes sense to me that there isn't one. I could be wrong but i'm not surprised.

as for it just not being there, i'm not surprised either. clients can hide/spoof it anyway so i avoid using it.

Vegans are friends, not food...
 
Have you thought of testing for button?

Code:
<!--- buttontest.cfm --->
Form <cfif IsDefined("Form.MySubmitButton")>
	Submitted
<cfelse>
	Refreshed
</cfif>
<br>
<form action="buttontest.cfm" method="post">
	<input name="MySubmitButton" type="Submit" value="MySB">
</form>


Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
Thank you for the reply. Yes, I'm already using that in a similar context and plan to check referer with it too.
 
No, I ment to see if checking if the submit button in the form was clicked in the previous document and not be concerned what that document was; sometimes that can be the solution.

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
Sorry I wasn't clear. Not cgi.referer but what the referer corresponding to a button name in it.
 
have you guys considered

<form action = "handler.cfm?from=#cgi.script_name#">
or
<meta http-equiv="refresh" content="60;url=http://yoursite.com?metarefresh=true">

you can also pass the cgi.script_name when opening a new window in JS. that should take care of knowing what the referring page is.






Vegans are friends, not food...
 
At the risk of stating the obvious.... I was looking at using referer for an administrative task on my intranet and saw this gem.

I copied this off of w3c:
HTTP_REFERER Returns a string containing the URL of the page that referred the request to the current page using an <a> tag. If the page is redirected, HTTP_REFERER is empty
The empty string in referer now has meaning...

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top