Answers.Body: <p>This sounds similar to a payment processor flow (especially the "button" style processors). In those, you typically pass a "return URL" to the remote site, and they would in turn direct your visitor back to the specified URL.</p>
  
  <p>If the return URL needs to be a separate callback (eg an <a href="https://en.wikipedia.org/wiki/Instant_payment_notification" rel="nofollow">IPN URL</a>), then you might add additional parameters (<code>&amp;return=civicrm%2Fevent%3Fid%3D1%26reset%3D1</code>) to the IPN URL, and the IPN can in turn decode that (<code>civicrm/event?id=1&amp;reset=1</code>) and perform a final redirect to land the user on the page they originated from.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-07T21:31:09.697Z
Answers.LastActivityDate: 2015-07-07T21:31:09.697Z
Answers.UserDisplayName: Chris Burgess
Answers.Body: <p>Can you use the superglobal?  That is, <code>$_SERVER['HTTP_REFERER']</code>?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-09T22:01:14.173Z
Answers.Text: Not reliably, browsers vary in how much referer they share, and [if a website is accessed from a HTTP Secure (HTTPS) connection and a link points to anywhere except another secure location, then the referrer field is not sent.](https://en.wikipedia.org/wiki/HTTP_referer) (I presume but haven't confirmed "link" to also mean "redirect".)
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-07T22:01:09.820Z
Answers.LastActivityDate: 2015-07-07T22:01:09.820Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I am working on a <a href="https://github.com/siddharthg/org.civicrm.civisocial" rel="nofollow">CiviCRM plugin that will act as a unified solution for social media login</a>. </p>
  
  <p>Once someone clicks the Login button which this plugin adds (eg to an event page), he or she is redirected to a new page for further data exchange (eg login on Twitter, Google+ etc).</p>
  
  <p>Is there a way I can get to know from which the button was clicked?</p>
  
  <p>One way is to store the same while clicking the button or send it to the new page as a GET or POST variable. I just wanted to check if we already storing/getting it up somewhere in CiviCRM.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-07T00:44:39.573Z
Comments.Text: What login button?
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-07T09:02:04.293Z
Comments.Text: Which CMS are you using?
Comments.UserDisplayName: davejenx
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-07T10:53:56.330Z
Comments.Text: Can you tell a little more about what you are trying to accomplish with knowing where you come from? That might help us all to provide you with options?
Comments.UserDisplayName: ErikH - CiviCooP
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-07T21:33:07.433Z
Comments.Text: Sid - it might help to add documentation to the README on Github which illustrates your intended flow, as well as the features you're aiming to implement. Did we discuss that a few weeks back? Maybe it's in email or something instead of on Github?
Comments.UserDisplayName: Chris Burgess
Tags: <extension><gsoc>
Title: Is there any way I can know from which page I came from?
ThreadText: # Is there any way I can know from which page I came from?
  
  (Asked by: username_0 on 2015-07-06)
  
  I am working on a [CiviCRM plugin that will act as a unified solution for social media login](https://github.com/siddharthg/org.civicrm.civisocial).
  
  Once someone clicks the Login button which this plugin adds (eg to an event page), he or she is redirected to a new page for further data exchange (eg login on Twitter, Google+ etc).
  
  Is there a way I can get to know from which the button was clicked?
  
  One way is to store the same while clicking the button or send it to the new page as a GET or POST variable. I just wanted to check if we already storing/getting it up somewhere in CiviCRM.
  
  **Tags:** extension, gsoc
  
  > **Comments:**
  > **username_1**: What login button?  
  > **username_2**: Which CMS are you using?  
  > **username_3**: Can you tell a little more about what you are trying to accomplish with knowing where you come from? That might help us all to provide you with options?  
  > **username_4**: Sid - it might help to add documentation to the README on Github which illustrates your intended flow, as well as the features you're aiming to implement. Did we discuss that a few weeks back? Maybe it's in email or something instead of on Github?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_4 on 2015-07-07. Score: 1 | Accepted answer
  
  This sounds similar to a payment processor flow (especially the "button" style processors). In those, you typically pass a "return URL" to the remote site, and they would in turn direct your visitor back to the specified URL.
  
  If the return URL needs to be a separate callback (eg an [IPN URL](https://en.wikipedia.org/wiki/Instant_payment_notification)), then you might add additional parameters (`&return=civicrm%2Fevent%3Fid%3D1%26reset%3D1`) to the IPN URL, and the IPN can in turn decode that (`civicrm/event?id=1&reset=1`) and perform a final redirect to land the user on the page they originated from.
  
  
  ---
  
  ### Answer by username_5 on 2015-07-07. Score: 1
  
  Can you use the superglobal? That is, `$_SERVER['HTTP_REFERER']`?
  
  > **Comments:**
  > **username_4**: Not reliably, browsers vary in how much referer they share, and [if a website is accessed from a HTTP Secure (HTTPS) connection and a link points to anywhere except another secure location, then the referrer field is not sent.](https://en.wikipedia.org/wiki/HTTP_referer) (I presume but haven't confirmed "link" to also mean "redirect".)  
  
  ---
  
  