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 7192459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:56:42+00:00 2026-05-28T19:56:42+00:00

I have a PHP / Javascript page that automatically logs a user into different

  • 0

I have a PHP / Javascript page that automatically logs a user into different systems from one log on. These are external sites and all works good except when the user hits the back button. It then redirects them right back where they came from.

I’m looking to have it redirect back to my main website and avoid getting stuck in this redirect nightmare. So I tried document.referrer, but that only seems to grab the current page I’m on and not the referred site. Am I wrong or can this not be done like this?

function myfunc () {
    var frm = document.getElementById("loggedin1");
    if(document.referrer != 'https://someurl') {
        alert(document.referrer);//Just used to see output
        frm.submit();
    }
}

window.onload = myfunc;

If I could get it to function I would add an else in there and have it going back to my website.

Thanks!

  • 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-28T19:56:43+00:00Added an answer on May 28, 2026 at 7:56 pm

    It sounds like you are trying to go back to a previous page, that is not within the website of the page you’re on?

    A few points:
    1) document.referrer will only work if the person got to the current page through a link, or clicking something…. not if they were redirected through other means.
    2) Due to browser security implementations, you will not be able to access the javascript history for other sites. So if you go from your site, site A, to site B for a login, you will not be able to access the site A history from site B.

    If you need to take them back to the previous page they were on on your site, can you use an iframe to load the external page? that way they’ll never leave your site? Or maybe a window popup?

    If what you are trying to accomplish is site logins, have you looked into the available apis? Sites like facebooks have apis for allowing logging in on your site through theirs.

    Cheers!

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

Sidebar

Related Questions

I have a php page that displays rows from a mysql db as a
I have a PHP page that will collect mp3 links from downloads.nl. The result
I'm new to javascript, my problem is effectively: I have a php page that
I have a php page that has multiple iframes on the page. these iframes
I have a php page and i have some javascript code to have a
How do I pass have a Javascript script request a PHP page and pass
I have a php script that uses some css/javascript tabs, they work on my
I have a PHP application that makes extensive use of Javascript on the client
I have one project with is developed in Php and javascript. How to open
I have a simple PHP upload page that when finished uploading runs a bit

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.