在第二次点击 ionic v1 时输入 iframe 停止在 IOS 上工作
Input iframe stop work on IOS in second tap ionic v1
我有一个 ionic v1 应用程序,它有一个 iframe
。我尝试在输入字段中写入,没问题。但是当我第二次点击输入时,我不能再写了。这只发生在 IOS;对于 Android 上的任何 iframe
,只要其中有一个输入字段,它就可以完美地工作。
我已经尝试通过window.addEventListener
处理焦点和触摸事件,但还是不行。我还尝试上下触发键盘。如果您能帮助我,我将在这件事上度过很多周,我将不胜感激。在此link我留下一些证据Video Evidence
window.addEventListener('blur', function() {
focusElement();
});
window.addEventListener('native.keyboardshow', focusElement);
function focusElement() {
$timeout(function() {
var iframe = document.getElementById('ofertasExclusivasIframe');
iframe.contentWindow.focus();
console.log("----------loaded---------", iframe)
}, 250);
}
$scope.$on('$destroy', handleDestroy);
function handleDestroy() {
$window.removeEventListener('native.keyboardshow', focusElement);
}
我通过在 iframe 所在的视图中持续保持焦点来解决问题
if (typeof cordova !== 'undefined' && $cordovaDevice.getPlatform() === 'iOS') {
window.setInterval(function() {
var myFrame = document.getElementById('Iframe');
myFrame.contentWindow.focus();
}, 500);
}
我有一个 ionic v1 应用程序,它有一个 iframe
。我尝试在输入字段中写入,没问题。但是当我第二次点击输入时,我不能再写了。这只发生在 IOS;对于 Android 上的任何 iframe
,只要其中有一个输入字段,它就可以完美地工作。
我已经尝试通过window.addEventListener
处理焦点和触摸事件,但还是不行。我还尝试上下触发键盘。如果您能帮助我,我将在这件事上度过很多周,我将不胜感激。在此link我留下一些证据Video Evidence
window.addEventListener('blur', function() {
focusElement();
});
window.addEventListener('native.keyboardshow', focusElement);
function focusElement() {
$timeout(function() {
var iframe = document.getElementById('ofertasExclusivasIframe');
iframe.contentWindow.focus();
console.log("----------loaded---------", iframe)
}, 250);
}
$scope.$on('$destroy', handleDestroy);
function handleDestroy() {
$window.removeEventListener('native.keyboardshow', focusElement);
}
我通过在 iframe 所在的视图中持续保持焦点来解决问题
if (typeof cordova !== 'undefined' && $cordovaDevice.getPlatform() === 'iOS') {
window.setInterval(function() {
var myFrame = document.getElementById('Iframe');
myFrame.contentWindow.focus();
}, 500);
}