<?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>dev.enekoalonso.com &#187; injection</title>
	<atom:link href="http://dev.enekoalonso.com/tag/injection/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.enekoalonso.com</link>
	<description>having fun with code</description>
	<lastBuildDate>Sat, 31 Jul 2010 05:51:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Injecting javascript with Firebug</title>
		<link>http://dev.enekoalonso.com/2008/11/30/injecting-javascript-with-firebug/</link>
		<comments>http://dev.enekoalonso.com/2008/11/30/injecting-javascript-with-firebug/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 05:29:22 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[injection]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=64</guid>
		<description><![CDATA[Sometimes you may want to include a Javascript file on a live web page to see how things will work or to try new things. Usually you would do this by editing the source code including the new file but there is a fastest way if you have Firefox with Firebug. Just run the following [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you may want to include a Javascript file on a live web page to see how things will work or to try new things. Usually you would do this by editing the source code including the new file but there is a fastest way if you have Firefox with Firebug. Just run the following code in the Javascript console:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> headID = document.<span class="me1">getElementsByTagName</span><span class="br0">&#40;</span><span class="st0">&quot;head&quot;</span><span class="br0">&#41;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> newScript = document.<span class="me1">createElement</span><span class="br0">&#40;</span><span class="st0">&#39;script&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">newScript.<span class="me1">type</span> = <span class="st0">&#39;text/javascript&#39;</span>;</div>
</li>
<li class="li1">
<div class="de1">newScript.<span class="me1">src</span> = <span class="st0">&#39;http://enekoalonso.com/lib/jquery-1.2.6.min.js&#39;</span>;</div>
</li>
<li class="li1">
<div class="de1">headID.<span class="me1">appendChild</span><span class="br0">&#40;</span>newScript<span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>Here I am loading the jQuery library from my own server, but I could load any Javascript from any server on the net. The best is this will work on any website, whenever you have access to the server or not. Once you have the Javascript loaded you can use it right away. For example, here on this blog I could use jQuery to check how the header will look if its height was only 100px by running the next command on the console:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1">jQuery<span class="br0">&#40;</span><span class="st0">&#39;#header&#39;</span><span class="br0">&#41;</span>.<span class="me1">css</span><span class="br0">&#40;</span><span class="st0">&#39;height&#39;</span>,<span class="nu0">100</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>Yep, it won&#8217;t look very good, right? Try it! You have to see it by yourself. Firefox is great. Firebug is awesome. And Firebug&#8217;s Javascript console is the best thing ever!<br />
PS: In case you are wondering, the Javascript file injected will exist only on the current browser session.</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>December 2, 2008 -- <a href="http://dev.enekoalonso.com/2008/12/02/highlighting-elements-with-firebug-console/" title="Highlighting elements with Firebug console">Highlighting elements with Firebug console</a> (0)</li><li>January 20, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/20/debugging-cookies-with-firebug-1-51-6/" title="Debugging cookies with Firebug 1.5/1.6">Debugging cookies with Firebug 1.5/1.6</a> (0)</li><li>January 19, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/19/firefox-3-6rc2-firebug-1-6a/" title="Firefox 3.6RC2 &#038; Firebug 1.6a">Firefox 3.6RC2 &#038; Firebug 1.6a</a> (0)</li><li>May 14, 2010 -- <a href="http://dev.enekoalonso.com/2010/05/14/interesting-json-vulnerability-old-stuff/" title="Interesting JSON vulnerability (old stuff)">Interesting JSON vulnerability (old stuff)</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2008/11/30/injecting-javascript-with-firebug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
