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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:03:34+00:00 2026-06-05T00:03:34+00:00

I have a web site which can be added as an icon to the

  • 0

I have a web site which can be added as an icon to the iPhone/iPad home screen (as all web sites can).
When tapping the icon the web site shows up in full screen mode (yay).
To prevent all links on this web site to open up in safari and thereby go away from the full screen mode, I’m overriding the click event of all html anchors.
This works great, but not on .NET linkbuttons, probably because they need to make a postback.

This is my code:

var iOS = (navigator.userAgent.match(/(iPad|iPhone|iPod)/i) ? true : false);
if (iOS) {
    $("a").click(function (event) {
        var href = $(this).attr("href");
        if (href.indexOf("doPostBack") == -1 && href.indexOf("javascript") == -1) {
            event.preventDefault();
            window.location = $(this).attr("href");
        }
    });
}

As you can see I’m trying to prevent this special behavior if the href contains “doPostBack” (which Linkbuttons do), or if they contain “javascript” (this is for links with e.g. onclick=’xxx()’).
This doesn’t work though. Links created with Linkbutton doesn’t respond, and I have no idea why.

Any help at all is much appreciated.
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-06-05T00:03:36+00:00Added an answer on June 5, 2026 at 12:03 am

    Alright. I finally solved this after a long session dedicated to the problem. Jump down to the end if you just want the solution.

    First of all, it’s not just linkbuttons, it’s everything that makes a postback with javascript. It could be a dropdownlist with autopostback = true, the same with ASP.NET checkboxes and so on.
    = A huge problem..

    First i figured out that the user-agent differs for iPhone/iPad when you go full screen.
    The first one is Safari and the second one is full screen “app”.

    Mozilla/5.0 (iPad; CPU OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3
    Mozilla/5.0 (iPad; CPU OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9A405
    

    So. Whats happening here? Well, .NET’s browser definition files doesn’t recognize the second user-agent and it’s defaulting to “Mozilla”, a very standarized and low level browser definition with very low capabilities.
    I tried creating a custom browser file where I defined a “new” browser, matching user-agents with regex: If it contained iPhone/iPad/iPod – tell .NET this is a Safari browser, not Mozilla.
    Unfortunelately I didn’t manage to get it to work. Neither by adding the file to the App_Browsers folder or registering the file globally with the framework.

    Anyway. I continued searching for a solution and found a workaround which I modified a bit.
    In your page’s PreInit method (or rather your basepage’s PreInit method) do this:

    protected void Page_PreInit(object sender, EventArgs e)
    {
        if (Request.UserAgent != null && (Request.UserAgent.Contains("iPhone") || Request.UserAgent.Contains("iPad") || Request.UserAgent.Contains("iPod")))
            this.ClientTarget = "uplevel";
    }
    

    This will make the browser look like IE6 to .NET which will make everything works perfectly.
    A heads up: If you are detecting for old browsers (IE 6 for example) anywhere in your code. Make sure it still works after this workaround. I had to add an extra if statement to exclude iOS devices from beeing redirected to my “you-got-an-old-browser-page”.

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

Sidebar

Related Questions

Here's the setup. I have web site which is essentially a simple CMS. Here
I have created a web site which is valid to strict XHTML and passes
I have a delete button on my web site which I want to add
I have a PHP5/Zend Framework 1.8.1 web site which is located at: http://www.example.com/foo The
I used to have an embedded user control in an ASP.NET web site which
I'm a beginner with Zend. I have a little web site in which I
I have a web site with an API which publishes the information using JSON.
i have to reach a web site content which have an url like that
I have a web site which enables user to add or delete their own
We have a reporting web site and in the search screen most of the

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.