브라우져를 열고 처음 클릭하면 열리지 않고
두번째클릭부터는 잘 열린다.
이유가 뭘까?
0.1초였었는데 1초로 변경하니 되네...
클로드(AI)의 답변으로는 iframe 로딩 지연때문이라고 한다.
const url = `호출프로그램::${command}`;
// 파라미터 추가
const queryParams = params
? Object.entries(params)
.map(([key, value]) => {
const encodedValue = encodeURIComponent(
typeof value === 'object' ? JSON.stringify(value) : String(value)
);
return `${key}=${encodedValue}`;
})
.join('&')
: '';
const fullUrl = queryParams ? `${url}?${queryParams}` : url;
// 1. 숨겨진 iframe 생성 방식
try {
const iframe = document.createElement('iframe');
iframe.style.display = 'none';
iframe.src = fullUrl;
document.body.appendChild(iframe);
// 잠시 후 iframe 제거
setTimeout(() => {
document.body.removeChild(iframe);
resolve(null);
}, 1000);
} catch (e) {
console.error('호출 오류:', e);
reject('호출 오류');
}반응형
'IT관련 > Angular' 카테고리의 다른 글
| Signal 정리 (1) | 2025.08.18 |
|---|---|
| VSCode에서 intelligence 및 assistant 기능 안될때 처리방법 (0) | 2025.07.15 |
| 자식요소에서 부모요소의 height셋팅값 알아내는 방법 (0) | 2025.06.10 |
| 탐색 확인 팝업 종료 체크 (1) | 2025.05.16 |
| 이벤트 루프에 대하여 (0) | 2025.04.09 |