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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:49:53+00:00 2026-06-13T22:49:53+00:00

I have an application where people can take on line test , When the

  • 0

I have an application where people can take on line test , When the user moves to another page the page should alert like you may lost the details if u go out of the page…
I tried of window.unload() but what i need is it should show alert only when the user moves to another page

Ex : My Page id test.php
if user clicks next button for next question the page will redirect to test.php?queNumber=2
so when the redirection happens to test.php it should not show alert if it redirects to other page like about.php or help.php it should alert , How to achive this ???

Thanks in advance

  • 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-06-13T22:49:54+00:00Added an answer on June 13, 2026 at 10:49 pm

    You can assign an event to all anchors in the page. And this event should check if anchor’s href contain ‘test.php’ or not.

    Try the following code:

    $('a').click(function(event) {
       var href = $(this).attr('href');
       if(href.indexOf('test.php') == -1) { //if href does not contain test.php
          event.preventDefault();
          alert('You are about to leave');
       }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing a Rails application where people can take quizzes. I have a model
I have a java application that people can log into (and do various things
Currently I have this code var App = Ember.Application.create(); App.user = Ember.Object.create({ people: customers
I have an application where people can give a phone number and it will
Currently we have an application who use spring who support mysql. Some people prefer
We have a business application written for Windows mobile. It has people doing inventories.
Hi Sitepoint wizard people, Say we have an admin application that has multiple users
I have a section of my application that allows for people to send an
I have the following requirements for an application that many people will be using
I have a website where people can contact each other, and quite often people

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.