
location.protocolにてページのprotocol情報を取得
location.protocolはhttp:やhttps:で返す
var protocol = location.protocol;
判別
var protocol = location.protocol;
if(protocol == 'http:'){
//httpの場合の処理
}else if(protocol == 'https:'){
//httpsの場合の処理
}
処理の実行結果
JavaScriptを使ったWEBコンテンツ作成 勉強中、サンプル作成やメモメモ
0 件のコメント :
コメントを投稿