ipad display not ipad dont display

I have been posting some code to do this but seems like its just more confusing, so ill keep things simple.
I am using ASP/Javascript page. I need to display a form in my page if a user is using an ipad and if they are not then display someting else, so .. simple as this:

If user is using ipad display "I am using ipad", if not display "I am using a computer"

thats it.
I am assuming this will require some javascript and some asp to display the conditional region based on the value passed by the javascript .. again .. i am not the expert.  I already have this code for an ASP/VBscript page and works like a charm, something simple like that would work. Attached is the ASP/VBscript code to use as reference if it is of any help.
Who is Participating?
pateljituConnect With a Mentor Commented:
Please try this javascript code:

<script type="text/javascript" language="javascript">

var isiPad = navigator.userAgent.match(/iPad/i) != null;

function checkUserAgent()
        alert("using ipad");
        document.getElementById("usingiPad").style.display = "";
        alert("Not using ipad");
        document.getElementById("usingDesktop").style.display = "";

<div  id="usingiPad" style="display:none;">
    Using iPad
   <form id="someform"></form>

<div id="usingDesktop" style="display:none;">
    Using Desktop

<!--End of the page-->
<script type="text/javascript" language="javascript">
    function setSequence(){
        if (document.addEventListener) {
          document.addEventListener("DOMContentLoaded", checkUserAgent(), null);
        window.onload = checkUserAgent();


Open in new window

Your code looks OK for identifying USER_AGENT, only change would be you body part i.e:

<%If isIPad() then%>
    using ipad
    Not using ipad
<%End If%>

Open in new window

Please also have a look at this article:

in this sample on line as below add ipad:
.Pattern = "(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|windows ce|pda|mobile|mini|palm|ipad)"
AleksAuthor Commented:
I know, that is VBScript which works just fine. I need that in JAVASCRIPT
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.