<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web Geliştirici &#187; harici</title>
	<atom:link href="http://www.webgelistirici.com/tag/harici/feed" rel="self" type="application/rss+xml" />
	<link>http://www.webgelistirici.com</link>
	<description>:: PHP, JavaScript, Ajax, XHTML, XML, CSS, MySQL ve diğer web yazılım geliştirme teknolojileri hakkında faydalı bilgi ve teknikler</description>
	<lastBuildDate>Sun, 21 Feb 2010 05:55:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Farklı Tarayıcılar İçin Farklı JavaScript Harici Dosyası Kullanmak</title>
		<link>http://www.webgelistirici.com/farkli-tarayicilar-icin-farkli-javascript-harici-dosyasi-yuklemek.html</link>
		<comments>http://www.webgelistirici.com/farkli-tarayicilar-icin-farkli-javascript-harici-dosyasi-yuklemek.html#comments</comments>
		<pubDate>Sun, 14 Feb 2010 07:37:07 +0000</pubDate>
		<dc:creator>Bülent Yılmaz</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[harici]]></category>

		<guid isPermaLink="false">http://www.webgelistirici.com/?p=29</guid>
		<description><![CDATA[Sayfamızda kullanacağımız JavaScript kodlarını harici bir dosyada toplayabiliriz. Bu durumda bu kodları &#60;script src="dosya.js" type="text/javascript"&#62; şeklinde sayfamıza ekleriz.
Tarayıcı türümüze özel kodlarımızı ayrı dosyalarda toplayıp, sadece ilgili tarayıcı için gerekli kodları yükletmek istersek şu yöntemi kullanabiliriz.

if &#40;document.all&#41; // Internet Explorer için
&#123;
   document.write&#40;'&#60;script src=&#34;ie.js&#34; type=&#34;text/javascript&#34;&#62;'&#41;;
&#125;
else if &#40;document.style&#41; // Firefox için
&#123;
   document.write&#40;'&#60;script src=&#34;ff.js&#34; type=&#34;text/javascript&#34;&#62;'&#41;;
&#125;

Burada [...]]]></description>
			<content:encoded><![CDATA[<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } -->Sayfamızda kullanacağımız JavaScript kodlarını harici bir dosyada toplayabiliriz. Bu durumda bu kodları <code>&lt;script src="dosya.js" type="text/javascript"&gt;</code> şeklinde sayfamıza ekleriz.</p>
<p>Tarayıcı türümüze özel kodlarımızı ayrı dosyalarda toplayıp, sadece ilgili tarayıcı için gerekli kodları yükletmek istersek şu yöntemi kullanabiliriz.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">all</span><span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">// Internet Explorer için</span>
<span style="color: #009900;">&#123;</span>
   document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;script src=&quot;ie.js&quot; type=&quot;text/javascript&quot;&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">style</span><span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">// Firefox için</span>
<span style="color: #009900;">&#123;</span>
   document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;script src=&quot;ff.js&quot; type=&quot;text/javascript&quot;&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Burada özellik algılama tekniğini kullanarak tarayıcı türünü öğrendik ve uygun harici JavaScript dosyasını sayfamıza dahil ettik. Tarayıcı türünü tespit etmek için <code>navigator.userAgent</code> ile elde edilen metindeki bilgiler de kullanılabilirdi. Ayrıca JavaScript&#8217;te <code>write()</code> fonksiyonu içine bu şekilde HTML kodları gömmek mümkündür.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webgelistirici.com/farkli-tarayicilar-icin-farkli-javascript-harici-dosyasi-yuklemek.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
