Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- jquery
- linux
- html
- 공모주 청약
- 공모주
- IPO
- 공모주 청약 일정
- Stock
- Eclipse
- 7월 공모주 청약 일정
- java
- 6월 공모주 청약 일정
- 주식 청약 일정
- JavaScript
- css
- 주식 청약
- 코드이그나이터
- 자바스크립트
- php
- 오라클
- codeigniter
- MYSQL
- SQL
- Stock ipo
- 자바
- 주식
- 제이쿼리
- 리눅스
- Oracle
- 맥
Archives
- Today
- Total
개발자의 끄적끄적
[javascript/jquery] javascript http to https redirect example 본문
개발/javascript & jquery
[javascript/jquery] javascript http to https redirect example
효벨 2022. 8. 6. 01:00728x90
반응형
[javascript/jquery] javascript http to https redirect example
javascript 에서
http 로 접속된 도메인을 https 로 리다이렉트 시켜야 하는 경우가 있습니다.
그럴때는 아래 스크립트를
이용하시면 됩니다!
if (document.location.protocol == 'http:') {
document.location.href = document.location.href.replace('http:', 'https:');
}
위 내용을 보시면 아시겠지만,
document.location.protocol 을 출력해보면
http: 나 https: 가 출력됩니다.
이것을 이용해서 접속 url 을 체크하고,
location.href 로 https 로 변경된 도메인으로 리다이렉트 시키는 방법입니다!
참고들 하세요!
반응형
'개발 > javascript & jquery' 카테고리의 다른 글
Comments