ユーザーエージェントによって読み込むスクリプトを変更する

これができるとイロイロと便利です。

<script type="text/javascript">
$(function(){
	var _ua = (function(){
	 return {
	  ltIE6:typeof window.addEventListener == "undefined" && typeof document.documentElement.style.maxHeight == "undefined",
	  ltIE7:typeof window.addEventListener == "undefined" && typeof document.querySelectorAll == "undefined",
	  ltIE8:typeof window.addEventListener == "undefined" && typeof document.getElementsByClassName == "undefined",
	  ltIE9:document.uniqueID && !window.matchMedia,
	  gtIE10:document.uniqueID && document.documentMode >= 10,
	  Trident:document.uniqueID,
	  Gecko:'MozAppearance' in document.documentElement.style,
	  Presto:window.opera,
	  Blink:window.chrome,
	  Webkit:!window.chrome && 'WebkitAppearance' in document.documentElement.style,
	  Touch:typeof document.ontouchstart != "undefined",
	  Mobile:typeof window.orientation != "undefined",
	  Pointer:window.navigator.pointerEnabled,
	  MSPoniter:window.navigator.msPointerEnabled
	 }
	})();
	
	function require(src){
	var element=document.createElement('script');
	element.type='text/javascript';
	element.src=src;
	document.getElementsByTagName('head')[0].appendChild(element);
	}
	
	if(_ua.ltIE8 || _ua.Gecko || _ua.Webkit){
		$('#wrapper').css("background","#000000");
		require('js/sample_ie.js');
	}else{
		require('js/sample.js');
	}
});
</script>

参考ページ
https://w3g.jp/blog/tools/js_browser_sniffing
http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1161871241

フルパスの探し方

htaccessでよく使う、フルパスの探し方。

phpinfo作って

<?
phpinfo();
?>

以下の文字列を検索!!

DOCUMENT_ROOT

htaccessはこれで作れる。
http://www.htaccesseditor.com/#a_basic

FBのクローラを許可したげる設定はこれ。

# FBクローラーを許可する
SetEnvIf User-Agent &quot;^facebookexternalhit.*$&quot; fb_crawler
Allow from env=fb_crawler

http://www.tam-tam.co.jp/tipsnote/program/post117.html

OGP固定ページ出し分け

OGP固定ページ出し分け

<?php if(is_page()): ?>
<meta property="og:title" content="株式会社N2P">
<meta property="og:type" content="article">
<meta property="og:description" content="O2Oを得意とするクリエイティブエージェンシー株式会社NONAME Produce、N2PのWebサイトです。">
<meta property="og:url" content="http://dev.n2p.co.jp">
<meta property="og:image" content="http://dev.n2p.co.jp/wp/wp-content/uploads/2013/10/n2plogp14.png">
<meta property="og:site_name" content="株式会社N2P">
<meta property="og:email" content="info@n2p.co.jp">
<?php endif; ?>

htaccessでSSL対応

ファイル数少ない場合(SSL領域がディレクトリで分かれていない場合)

RewriteEngine on

RewriteCond %{REQUEST_URI} .*/form.php$ [OR]
RewriteCond %{REQUEST_URI} .*/confirm.php$ [OR]
RewriteCond %{REQUEST_URI} .*/comp.php$
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

RewriteCond %{REQUEST_URI} .*/index.html$ [OR]
RewriteCond %{REQUEST_URI} .*/index02.html$ [OR]
RewriteCond %{REQUEST_URI} .*/index03.html$
RewriteCond %{HTTPS} on
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R,L]

参考にしたページ
http://www.meibinlab.jp/nishijima/archives/54

Android2.3でフォームのバグ

selectタグをjQueryで可視化・不可視化などすると、
Android2.3で、正常に挙動しなくなる。
例えば以下のように書き換えてやればいい。
ポイント。
document.getElementById(‘quoAllWrap’).setAttribute(‘style’,’display:block’);

			function formchange(){
				if(formFlag == 'quo'){
					$('#koukonAllWrap').hide();
					document.getElementById('quoAllWrap').setAttribute('style','display:block');
					//$('#quoAllWrap').show();
					exvalidationgo();
				}else{
					$('#quoAllWrap').hide();
					document.getElementById('koukonAllWrap').setAttribute('style','display:block');
					//$('#koukonAllWrap').show();	
					exvalidationgo();
				};
			};

出典
https://www.facebook.com/alicecode/posts/145516658904010

IE8で半透明背景

IE8で半透明な背景を実装する方法。
.show など、透明度をjsなどで変更する場合、
ただcssで指定しておくだけでは、
半透明が無効になってしまう。
要素の操作後にscriptの側から改めて指定してあげなくてはいけないみたい……。
(4行目末尾のように)

	$(window).on('load resize', function(){
		var winWidth = $(window).width();
		var winHeight = $(window).height();
		$('#allWrap').css('width',winWidth).css('height',winHeight).css('opacity', .6);
	});