본문 바로가기

전체보기161

browser 이름 및 version script function getbrowserinfo () { var ua=navigator.userAgent,tem,M=ua.match(/(edge|opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [],Edge = ua.match(/(edge(?=\/))\/?\s*(\d+)/i) || []; if(/trident/i.test(M[1])){ tem=/\brv[ :]+(\d+)/g.exec(ua) || []; return {name:'IE',version:(tem[1]||'')}; } else if ( Edge != null && Edge != '' ) { return { name: 'Edge', version: Edge[2] }; } else if.. 2018. 2. 26.
webpush 사용하기 1. Service Worker 등록하기 참고 : chrome://serviceworker-internals 등록되어 있는 service worker 확인참고 : firefox 는 about:debugging 등록되어 있는 service worker 확인 가. https 사이트가 필요함. 나. service worker 에 등록할 javascript event : install, activate, push 'use strict'; self.addEventListener('push', function(event) { console.log('[Service Worker] Push Received.'); console.log(`[Service Worker] Push had this data: "${event... 2018. 2. 22.
Chrome 301 Redirect 현황 보기 chrome://net-internals 2018. 2. 21.
css 추가 javascript addbackgroundcss :{value : function(layout) {if ( layout['bg_img'] == '' )return;var css = '{ }', head = this.root.head; style = document.createElement('style');style.type = 'text/css';if (style.styleSheet){ style.styleSheet.cssText = css;} else { style.appendChild(document.createTextNode(css));}head.appendChild(style);}}, 2018. 2. 19.
express 시작하기 1, express 생성하기 설치 npm install -g express-generator 2. project 생성 ( ejs 사용 할 경우 ) express --ejs project 3. 필요 module 설치하기 #cd project #npm install 4. 구동하기 node ./bin/www or npm start 5. 설정 가. Port 변경 vi ./bin/www var port = normalizePort(process.env.PORT || '3000'); 2018. 2. 7.
javascript 사이즈 별 계산해서 ellipsis 시키는 함수 function ellipsizeTextBox(el) { var keep = el.innerHTML; while(el.scrollHeight > el.offsetHeight) { alert(el.scrollHeight +" " + el.offsetHeight); el.innerHTML = keep; el.innerHTML = el.innerHTML.substring(0, el.innerHTML.length-1); keep = el.innerHTML; el.innerHTML = el.innerHTML + "..."; }} 파이어 폭스에서 무한 루프가 발생하므로 주의 할것... 2018. 2. 2.
nginx 내부에서 redirect 시키기 socket.io 패스를 변경할 경우 기존 경로 처리도 동반되어야 한다. GET /socket.io/?EIO=3&transport=websocket&sid=7s_G-xWsSJ9lxK7ZAAAP HTTP/1.1 socket.io 패스를 xxx 로 변경하고 싶다면 nginx redirect 하는 부분에도 socket.io 를 받아서 처리해줘야 한다. location /socket.io/ { rewrite ^/socket.io/(.*) /xxx/$1; proxy_pass http://mysite; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header .. 2018. 1. 30.
nginx redirect 시에 socket-io 에서 client ip 얻어오기 nginx 에서 환경 설정 가. 아래 두개의 옵션을 필수 로 컴파일 한다.--with-http_ssl_module --with-http_realip_module 나. conf 파일 server { listen 8080; real_ip_header X-Forwarded-For; real_ip_recursive on; location / { proxy_pass http://mysite; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set.. 2018. 1. 23.
nginx 에서 307 internal redirect 가 발생하는 경우 HTTP Strict Transport Security 설정 #add_header Strict-Transport-Security "max-age=31536000"; 위의 항목이 있는지 확인한다.Loadbalancing 의 경우는 빼야 함... 이것 때문에 완존 고생...영구적으로 redirect 시킬경우는 넣어주는 것이 좋다. 2018. 1. 16.
socket io 에서 WebSocket connection to 'wss: 오류 발생시 NGINX 에서 redirect 시킬 경우 해당 부분에서 오류가 발생한다. WebSocket connection to 'ws://.../socket.io/?EIO=2&transport=websocket&sid=p3af7ZNfvogtq6tAAAG0' failed: Error during WebSocket handshake: Unexpected response code: 400. 이럴경우 하단의 3개의 Header를 설정시켜 주면 발생하지 않는다. location / { .......................... proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } 2018. 1. 16.