A
A
Amir Gafurov2015-03-12 15:37:13
JavaScript
Amir Gafurov, 2015-03-12 15:37:13

Why doesn't device.js + ipad3 work?

There is a design

<a href="tel: 123" class="link">
 <span>text</span>
</a>


$('.link').on('click', function(e) {
  if (!device.mobile()) {
    e.preventDefault();
                
     // вызов попапа

  }
 });


when clicking on a desktop and a tablet, a popup should be called, and a call should be sent on a mobile phone. I implemented these conditions through device.js, tested it on the iPad Mini, android phone - everything works as it should. Checked on iPad 3 - there is a call ...

Checked even so
$('.link').on('click', function(e) {
  alert('test');
  if (!device.mobile()) {
    e.preventDefault();
                
     // вызов попапа

  }
 });

and no alert

What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Amir Gafurov, 2015-03-12
@amir73911

I found the reason: if the href of the link contains "tel:", then iOS completely discards all events hung on this link, and only performs the default value - a call.
I solved the problem like this: on the tablet and desktop, I replace the href of the links with # and everything works.

D
Dima Pautov, 2015-03-12
@bootd

If you go to the off site , then through the emulator (chrome) it works fine for me!
Check what the method returns! Open the off page and find out! Here is your answer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question