<?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>&#039;corePHP&#039; Blog &#187; Javascript</title>
	<atom:link href="http://www.corephp.com/blog/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.corephp.com/blog</link>
	<description>Keep up to date on what&#039;s happening at &#039;corePHP&#039;</description>
	<lastBuildDate>Thu, 02 Feb 2012 16:36:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1.2</generator>
		<item>
		<title>jQuery click event fires twice</title>
		<link>http://www.corephp.com/blog/jquery-click-event-fires-twice/</link>
		<comments>http://www.corephp.com/blog/jquery-click-event-fires-twice/#comments</comments>
		<pubDate>Wed, 20 Jul 2011 13:29:27 +0000</pubDate>
		<dc:creator>Rafael Corral</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.corephp.com/blog/?p=2927</guid>
		<description><![CDATA[Today I had an issue with jQuery where a listener for a &#8216;click&#8217; event was being triggered twice. With the following code, I would get two logs in the console: jQuery(document).ready(function(){ jQuery('#button').click(function(){ console.log(1); return false; }); }); I was even &#8230; <a href="http://www.corephp.com/blog/jquery-click-event-fires-twice/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today I had an issue with jQuery where a listener for a &#8216;click&#8217; event was being triggered twice.<br />
With the following code, I would get two logs in the console:</p>
<pre>jQuery(document).ready(function(){
	jQuery('#button').click(function(){
		console.log(1);
		return false;
	});
});</pre>
<p>I was even trying the jQuery(function() { }); method, but I would still get the same results.</p>
<p>After some debugging, I figured out that if I moved that javascript to be inside the &lt;head&gt;&lt;/head&gt; tag instead of the &lt;body&gt;&lt;/body&gt; tag which is where I originally had it, that would fix the problem.</p>
<p>Hope it helps,<br />
Rafael Corral<br />
Lead developer</p>
]]></content:encoded>
			<wfw:commentRss>http://www.corephp.com/blog/jquery-click-event-fires-twice/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Control HTML without javascript</title>
		<link>http://www.corephp.com/blog/control-html-without-javascript/</link>
		<comments>http://www.corephp.com/blog/control-html-without-javascript/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 15:05:42 +0000</pubDate>
		<dc:creator>Rafael Corral</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.corephp.com/index.php?option=com_wordpress&amp;p=2030&amp;Itemid=176</guid>
		<description><![CDATA[This is something I have known about for a long time. It is advanced and can mostly be used for Cross Site Request Forgeries (CSRF). Not that I condone these, but the best way to defend yourself against hackers is &#8230; <a href="http://www.corephp.com/blog/control-html-without-javascript/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is something I have known about for a long time. It is advanced and can mostly be used for <a title="Cross site request forgery" href="http://en.wikipedia.org/wiki/Cross-site_request_forgery" target="_blank">Cross Site Request Forgeries</a> (CSRF). Not that I condone these, but the best way to defend yourself against hackers is by knowing as much as they do.</p>
<p>In some cases users turn javascript off in their browsers (I do) for security reasons. HTML has just about no scripting capabilities if you discard the FOR attribute on the LABEL tag. It is possible to trick a user into submitting a form by them simply highlighting text on a page. The FOR attribute binds a label to another element, which is some sort of scripting, I guess.</p>
<p><span id="more-2030"></span>Well, by simply wrapping the BODY of a page in a LABEL tag, which contains text and HTML, the LABEL and its contents become a button through binding of the FOR. This all happens behind the scenes. This means that whenever you select text or click on the body of the page, the binding becomes active, and it is possible to submit a form without any scripting at all!</p>
<p><strong>Example:</strong></p>
<pre>&lt;label for="action"&gt;
&lt;body&gt;
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
&lt;/body&gt;
&lt;/label&gt;

&lt;form action="http://twitter.com/logout" method="get"&gt;
 &lt;input type="submit" id="action" style="display:none;"&gt;
&lt;/form&gt;</pre>
<p>On my example I show a POC on how you could automatically log someone out of twitter by them simply clicking on a page. Twitter has fixed this CSRF by simply checking the referrer on the browser: If it doesn&#8217;t match twitter.com, it sends you to another logout page for you to confirm your action.</p>
<p>This is good knowledge. Use it to protect yourself and not to harm others.</p>
<p>I use a plugin for FireFox called <a title="NoScript" href="http://noscript.net/" target="_blank">NoScript</a>. This plugin will block all scripts on a per-domain basis. If you trust the domain, then you can enable those scripts. This is extremely helpful because I visit many hacked packages on a weekly basis and I do not want my computer to get a virus. This plugin will protect you from at least 70% of web attacks. I highly encourage you to use it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.corephp.com/blog/control-html-without-javascript/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Hardcore Javascript browser &amp; computer fingerprinting</title>
		<link>http://www.corephp.com/blog/hardcore-javascript-browser-and-computer-fingerprinting/</link>
		<comments>http://www.corephp.com/blog/hardcore-javascript-browser-and-computer-fingerprinting/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 17:40:07 +0000</pubDate>
		<dc:creator>Rafael Corral</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Operating System]]></category>

		<guid isPermaLink="false">https://www.corephp.com/index.php?option=com_wordpress&amp;p=1482&amp;Itemid=100069</guid>
		<description><![CDATA[This post contains a POC (Proof of concept) on how to detect if a user is using the same computer as they have previously used before. This can be useful if you want to register a user&#8217;s computer for a &#8230; <a href="http://www.corephp.com/blog/hardcore-javascript-browser-and-computer-fingerprinting/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This post contains a POC (Proof of concept) on how to detect if a user is using the same computer as they have previously used before. This can be useful if you want to register a user&#8217;s computer for a certain functionality that your website may have. It can also be used to only allow one computer to view private content of a site and has many other applications aside from being really cool!</p>
<p>The way the script works, it has functions to retrieve the following:</p>
<ul>
<li>Browser type</li>
<li>Display width &amp; height, color depth and available height</li>
<li>The plugins that are installed on the browser</li>
<li>The operating system the browser is running on</li>
</ul>
<p><span id="more-1482"></span>With these four pieces of information you have the option to MD5 hash them, which is what I recommend as it is shorter and easier to store in a database.</p>
<p>Please download the <a title="Browser detection download" href="http://www.corephp.com/misc_downloads/browser_detection.zip">files from here</a>. Two files are needed if you want to use the MD5 encryption.</p>
<pre>&lt;script src="md5.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="detector.js" type="text/javascript"&gt;&lt;/script&gt;</pre>
<p>To get all of the above information about the browser in one neat string with separators, call this JavaScript function:</p>
<pre>$fingerprint = pstfgrpnt();</pre>
<p>To get the values MD5 hashed, simply pass true through as a parameter.</p>
<p>The index.html file on the download includes a simple example.</p>
<p>That is it! Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.corephp.com/blog/hardcore-javascript-browser-and-computer-fingerprinting/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Fix the sIFR bug when logged in (UPDATED!)</title>
		<link>http://www.corephp.com/blog/fix-the-sifr-bug-when-logged-in-updated/</link>
		<comments>http://www.corephp.com/blog/fix-the-sifr-bug-when-logged-in-updated/#comments</comments>
		<pubDate>Wed, 14 May 2008 23:42:13 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Joomla]]></category>
		<category><![CDATA[Templates]]></category>

		<guid isPermaLink="false">http://c15.corephp.comindex.php?option=com_wordpress&amp;p=30</guid>
		<description><![CDATA[I ran into a strange bug today while implementing sIRF into Joomla!. Everything looked great until I logged into the front-end. Then the titles show this: Contact Us &#60;!‚Äì function olMouseMove(e) { var e = e ? e : event; &#8230; <a href="http://www.corephp.com/blog/fix-the-sifr-bug-when-logged-in-updated/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="entry">
<p><span style="font-family: arial,helvetica,sans-serif;">I ran into a strange bug today while implementing sIRF into Joomla!. Everything looked great until I logged into the front-end. Then the titles show this:<br />
</span></p>
<p><span style="font-family: arial,helvetica,sans-serif;">Contact Us &lt;!‚Äì function olMouseMove(e) { var e = e ? e : event; if (e.pageX) { o3_x = e.pageX; o3_y = e.pageY; } else if (e.clientX) { o3_x = eval(‚Äùe.clientX+o3_frame.‚Äù + docRoot + ‚Äú.scrollLeft‚Äù); o3_y = eval(‚Äùe.clientY+o3_frame.‚Äù + docRoot + ‚Äú.scrollTop‚Äù); } if (o3_allowmove == 1) {runHook(‚ÄùplaceLayer‚Äù,FREPLACE);if(olHideForm)hideSelectBox(); } if (hoveringSwitch &amp;&amp; !olNs4 &amp;&amp; runHook(‚ÄùcursorOff‚Äù, FREPLACE)) { olHideDelay ? hideDelay(olHideDelay) : cClick(); hoveringSwitch = !hoveringSwitch; } } //‚Äì&gt;<br />
</span></p>
<p><span style="font-family: arial,helvetica,sans-serif;">After many hours of frustration, we finally came up with a fix!</span></div>
<div class="entry">
<p><span style="font-family: arial,helvetica,sans-serif;">The error comes from a conflict between sIFR and OverLIB, so we just disabled OverLIB. To do this you have to open the base index.php file in the root directory. Go to line 214 and change FALSE to TRUE.</span></p>
<p><span style="font-family: arial,helvetica,sans-serif;"><code><br />
// set for overlib check<br />
$mainframe-&gt;set( 'loadOverlib', true );<br />
</code></span></p>
<p><span style="font-family: arial,helvetica,sans-serif;">Your site will now display sIRF correctly when logged in.</span></p>
<h3><span style="font-family: arial,helvetica,sans-serif;">UPDATE:</span></h3>
<p><span style="font-family: arial,helvetica,sans-serif;">While we realized that turning off OverLIB was not a good idea, we didn&#8217;t have any better alternatives&#8230;until now! The problem was caused by the fact that Joomla! loads the front-end edit button inside the div with the class &#8220;contentheading,&#8221; which is translated by sIFR. To solve this, you have to edit com_content/content.html.php to move the edit button into a separate &lt; td &gt; so that it&#8217;s in line with the pdf/email/print buttons (and out of the contentheading div).</span></p>
<p><span style="font-family: arial,helvetica,sans-serif;">Thanks to Mike at mike.simbunch.com for the sharing this fix with us.</span></div>
]]></content:encoded>
			<wfw:commentRss>http://www.corephp.com/blog/fix-the-sifr-bug-when-logged-in-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Close Window</title>
		<link>http://www.corephp.com/blog/close-window/</link>
		<comments>http://www.corephp.com/blog/close-window/#comments</comments>
		<pubDate>Mon, 05 Jun 2006 17:19:45 +0000</pubDate>
		<dc:creator>Steven</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://c15.corephp.comindex.php?option=com_wordpress&amp;p=27</guid>
		<description><![CDATA[Many people come across this issue with popup windows when they want to give the user a close button instead of the X up at the top. You can easily and quickly achieve this just by adding a &#8216;href&#8217; tag. &#8230; <a href="http://www.corephp.com/blog/close-window/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-family: arial,helvetica,sans-serif;">Many people come across this issue with popup windows when they want to give the user a close button instead of the X up at the top.</span></p>
<p><span style="font-family: arial,helvetica,sans-serif;">You can easily and quickly achieve this</span><span style="font-family: arial,helvetica,sans-serif;"> just by adding a &#8216;href&#8217; tag.<br />
</span></p>
<p><span style="font-family: arial,helvetica,sans-serif;">The following code is a sample, so customize it to whatever you need.</span></p>
<p><span style="font-family: arial,helvetica,sans-serif;"><code><br />
&lt;a target="_top" href="javascript:window.close()"&gt;Close Window&lt;/a&gt;</code></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.corephp.com/blog/close-window/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

