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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:43:40+00:00 2026-06-19T01:43:40+00:00

I ran in to a problem while developing a mobile app using Phonegap &

  • 0

I ran in to a problem while developing a mobile app using Phonegap & jQuery Mobile.

I’ve an entry condition to be checked everytime before a page is shown, say page A. If the condition goes false, i navigate the app to another page, say page X. I did that using the page event pagebeforeshow.

But my problem is that…

Even though i used the pagebeforeshow event, the page page A is getting shown. Ie; the page A is shown once and then the apps navigates to page X. I dont want this page A to be displayed if the condition is wrong. I mean, cancel the that page show event and move on to other page.

Hope you’ve got what i asked.

Why it is so? is there any other method through which i can accomplish my task perfectly.

Any kind of helps would be deeply appreciated! 🙂

  • 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-19T01:43:42+00:00Added an answer on June 19, 2026 at 1:43 am

    Don’t use pagebeforeshow event in this case, that is one of the last page events to trigger. At that point second page is already created and ready to be shown. This must be done before second page is about to be created.

    First take a look at my other ARTICLE, there you will find a list of page events during a transition from page one to page two. Or it can be found HERE.

    Now about your problem, here’s a code that you can use to fix your problem. It is using pagebeforechange event (which is a first event to trigger during a page transition):

    $(document).on('pagebeforechange', function(e, data){  
        var to = data.toPage,
            from = data.options.fromPage;
    
        if (typeof to  === 'string') {
            var u = $.mobile.path.parseUrl(to);
            to = u.hash || '#' + u.pathname.substring(1);
            if (from) from = '#' + from.attr('id');
    
            if (from === '#index' && to === '#second') {
                alert('Can not transition from #index to #second!');
                e.preventDefault();
                e.stopPropagation();
    
                // remove active status on a button, if transition was triggered with a button
                $.mobile.activePage.find('.ui-btn-active').removeClass('ui-btn-active ui-focus ui-btn');;
            }  
        }
    });
    

    And here’s a live jsFiddle example: http://jsfiddle.net/Gajotres/3PhKZ/, you should click on a next button to trigger a page change.

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

Sidebar

Related Questions

I ran into a problem while developing onto Blackberry. I am using KXML2 api
I ran in to an interesting problem while using the 'tap' method on objects
while working on a school project i ran into a problem using javascript to
Never ran into this problem with jQuery before. I have the following: $(document).ready(function() {
I've ran into a problem recently while developing with Spring Security. It has an
I just ran into a problem while developing a login system. I build a
I've recently ran into a very interesting problem while writing a web app with
I ran into this problem while developing in Objective-C for iOS, but this should
I'm developing in MVC2 using VB.NET and MySQL and ran into a problem trying
So, I just ran into an interesting problem while using the Scanner class to

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.