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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:36:01+00:00 2026-06-05T02:36:01+00:00

I am using Jquery Mobile to build a mobile version of an existing ASP.NET

  • 0

I am using Jquery Mobile to build a mobile version of an existing ASP.NET mvc3 site.

The way I am doing this is by detecting in my controllers if the page is being requested by a mobile or not and then providing a mobile-suited mvc view if there is one and providing the standard view if there isn’t.

The problem I am having is that links to pages which do not have a suitable view still get Ajaxed into the page by jquery-mobile, messing up the layout. I know you can disable this functionality on a link-by-link basis by using data-ajax=”false”, however I do not have control over each link as it is a CMS-based site so there is nothing to stop the user from linking to a page within the site that does not have a mobile view.

What I was hoping I could do is maybe include an attribute in the base view of the desktop version of the site which jquery mobile would pick up when it attempts to ajax load the page, rejecting it and reloading the link without ajax. Is this possible?

  • 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-05T02:36:02+00:00Added an answer on June 5, 2026 at 2:36 am

    For the time being I’ve done this:

    $(document).bind("pageload", function (event, data) {
        if ($("div[data-role=\"content\"]", data.xhr.responseText).length < 1) {
           window.location = data.url;                  
        } 
    });
    

    I’m checking that the loaded page contains jQuery mobile element data-role=”content” and if it doesn’t, redirecting the browser to the page proper. It’s not ideal though since I’m parsing the html of every page on load. It also means that the non-mobile site is loaded into jquery mobile, and then loaded again on the redirect (although this shouldn’t happen too often in this site).

    I also had to add an empty hidden div with data-role=”page” on the master view of the desktop version of the site because jquery mobile still tries to transition to the non-mobile site before the window.location kicks in and I couldn’t work out how to prevent that.

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

Sidebar

Related Questions

I am using jQuery Mobile to create a mobile ASP.NET MVC site I am
I have created a mobile version of my website using jquery mobile. My site
I am developing a site for mob using jquery mobile. I have a content
I am developing an events page using jquery mobile. I have a stylish way
I am trying to build a JQuery Mobile application. I want this application to
I'm using jQuery Mobile and Scrollview . This has been the perfect solution for
i have an app in Blackberry, I was Build in using Jquery Mobile, but
I'm trying to build a menu for a mobile app (using jQuery Mobile). I
I'm developing a mobile site for iPhone using jQuery. I have a hidden div
I want to create an ASP.NET web site. I have not been using ASP.NET

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.