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

  • Home
  • SEARCH
  • 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 6156511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:37:21+00:00 2026-05-23T20:37:21+00:00

I did find some javascript/activex code in a project, called when leaving a page

  • 0

I did find some javascript/activex code in a project, called when leaving a page (window.onbeforeunload):

My project is reachable at the address

www.someaddress.itdoesntexists/MyProjectName/page.jsp

When the logout function is called, the action in the page logout.jsp is correctly performed but at the end of the process the user is redirected to

www.someaddress.itdoesntexists

instead of

ww.someaddress.itdoesntexists/MyProjectName/

The code:

<script type="text/javascript">
var loggedout = false;

bVer = parseInt(navigator.appVersion);
bName = navigator.appName;
browserIE = bName == "Microsoft Internet Explorer";
browserNS = bName == "Netscape";

function sendHttpRequestSubmit (http_request, parameters) {
    http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    http_request.setRequestHeader("Content-length", parameters.length);
    http_request.setRequestHeader("Connection", "close");
    http_request.send(parameters);
}

function httpRequest(url, mime, callback, async, parameters) {
    var http_request = false;
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) http_request.overrideMimeType(mime);
    } else if (window.ActiveXObject) { // IE
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }
    if (!http_request) {
        alert('Unable to create a XMLHTTP instance');
        return false;
    }
    http_request.onreadystatechange = function () {
        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
                if (callback != null) callback(http_request);
            } else alert('There is a problem with the request "' + url + '"');
        }
    }
    async = async == null ? true : async;
    http_request.open('POST', url, async);
    if (parameters != null) sendHttpRequestSubmit(http_request, parameters);
    else http_request.send(null);
    if (browserNS && !async) {//
        if (callback != null) callback(http_request);
    }
}

function logout () {
    var sg;
    if (!loggedout)
        httpRequest ("logout.jsp?js=1", "text/javascript", function (http_request) {
            sg = eval(http_request.responseText);
        }, false);
    loggedout = true;
    return sg;
}

window.onbeforeunload = logout;

Can someone explain to me where to tell the script that it doesn’t have to go to the root path?

  • 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-23T20:37:22+00:00Added an answer on May 23, 2026 at 8:37 pm

    The script doesn’t directly declare the redirect – it simply handles a response from an AJAX call to logout.jsp?js=1 by evaluating it as a function – I would guess that you’ll need to modify that response text (so outside of the script you’ve posted) to get it to redirect to the location you want.

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

Sidebar

Related Questions

I have Googled merge+cell+Javascript but did not find any suitable code to implement merge
Did some googling and couldn't find a clear answer on this. My assumption is
How to install Ldap on windows7 and to configure it?? Did some googling..cant find
I've read the several discussions about storing code snippets but I did't find the
After some Google search, I did not find anything fill my need. I want
I am interested in where string literals get allocated/stored. I did find one intriguing
i did't find any property of a tab container to change background color of
I did not find any suitable questions answered yet, so I'd like to know
I did search the forum and did not find a similar question. I'm looking
I spent about hour and did not find any clue how to highlight my

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.