Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 396715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:34:46+00:00 2026-05-12T16:34:46+00:00

This seems like it should be simple. Any pointers would be much appreciated. Consider

  • 0

This seems like it should be simple. Any pointers would be much appreciated.

Consider three sites:

  • widgetserver.com, which serves widgets to client sites
  • clientsite.com, which displays the widget
  • previoussite.com, which is a site that links to clientsite.com

In clientsite.com’s page there is a piece of code that calls a PHP function on widgetserver.com. It looks like this:

<script type="text/javascript" src="http://widgetserver.com/show_widget.php></script>

When clientsite.com is loaded, it runs “show_widget.php”, which in turn places the widget on the page.

This is where I am stuck: I would like to access the site that referred the user to clientsite.com from inside “show_widget.php”, but while in this function we are on widgetserver.com, so the referrer is clientsite.com, not previoussite.com.

Is there any way I can pass clientsite.com’s referrer to “show_widget.php”?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T16:34:46+00:00Added an answer on May 12, 2026 at 4:34 pm

    document.referrer contains the referrer information you want, so if they’re running javascript, you could do something like this:

    <script language="javascript" type="text/javascript">
    var script = document.createElement("script");
    script.src = "http://widgetserver.com/show_widget.php?r="+document.referrer;
    document.getElementsByTagName("head")[0].appendChild(script);
    </script>
    

    This will need to go OUTSIDE of the head tag (unless it’s in a function being bound to the document ready event or something), or it will fail.

    The idea behind this is to generate a dynamic tag on the page with the attributes you want. The first line creates it, second line sets the script src, and the third page loads it into the document.head DOM element, which causes it to be evaluated, and loads the document as required.

    If your clients are using jQuery, it is easier to use $.getScript, with a similar use of document.referrer

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 198k
  • Answers 198k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer // edit: tested and works function product(set) { if(set.length <… May 12, 2026 at 7:29 pm
  • Editorial Team
    Editorial Team added an answer I'm guessing this is because this site uses ajax to… May 12, 2026 at 7:29 pm
  • Editorial Team
    Editorial Team added an answer You could hook into some event as in this silverlight… May 12, 2026 at 7:29 pm

Related Questions

I'm using the ASIHTTPRequest package to send some data from the iPhone to my
It's of course nice to give users friendly URLs for their content on your
I have a minor problem where my (new) computer tends to completely freeze up.
How do you tell Ctrl + R reverse-i-search to "reset itself" and start searching
I've got a very simple line of code in Objective-C: if ((selectedEntity != nil)

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.