<?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>VolkomenJuist.nl &#187; Javascript</title>
	<atom:link href="http://www.volkomenjuist.nl/blog/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.volkomenjuist.nl/blog</link>
	<description>Juist! Volkomen Juist!</description>
	<lastBuildDate>Mon, 08 Mar 2010 19:58:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to check whether Javascript is enabled in Wicket</title>
		<link>http://www.volkomenjuist.nl/blog/2010/01/19/how-to-check-whether-javascript-is-enabled-in-wicket/</link>
		<comments>http://www.volkomenjuist.nl/blog/2010/01/19/how-to-check-whether-javascript-is-enabled-in-wicket/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 21:31:49 +0000</pubDate>
		<dc:creator>Stefanovich</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Wicket]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.volkomenjuist.nl/blog/?p=337</guid>
		<description><![CDATA[It is possible, via Wicket, to gather a lot of information regarding the browser/system of your visitor. If you want this you can also turn on some extended information (like javascript is enabled) via the following code: getRequestCycleSettings().setGatherExtendedBrowserInfo(true); This method works via a redirect to the BrowserInfoPage and finally it goes to your &#8216;original&#8217; page. [...]]]></description>
			<content:encoded><![CDATA[<p>It is possible, via Wicket, to gather a lot of information regarding the browser/system of your visitor. If you want this you can also turn on some extended information (like javascript is enabled) via the following code:</p>
<pre class="brush: java;">
getRequestCycleSettings().setGatherExtendedBrowserInfo(true);
</pre>
<p>This method works via a redirect to the BrowserInfoPage and finally it goes to your &#8216;original&#8217; page. Because of this it is possible that you see the BrowserInfoPage very shortly especially on slow computers/browsers or internet connections. But what if you don&#8217;t want this and only want to know whether Javascript is enabled? Please read on&#8230;</p>
<p><span id="more-337"></span></p>
<p>When the page is rendered it does a call(back) to Wicket. If  this callback is possible then we can assume Javascipt is enabled.</p>
<h4>How to setup?</h4>
<p>e.g. Login.java (Page)</p>
<pre class="brush: java;">
final WebClientInfo clientInfo = (WebClientInfo) WebRequestCycle.get().getClientInfo();
final AbstractDefaultAjaxBehavior behavior = new AbstractDefaultAjaxBehavior()
   @Override
   protected void respond(final AjaxRequestTarget target) {
        if (target != null) {
            clientInfo.getProperties().setJavaEnabled(true);
        }
   }
};
add(behavior);

Label jsEnabledScript = new Label(&quot;jsEnabledScript&quot;, &quot;wicketAjaxGet('&quot;+ behavior.getCallbackUrl() +&quot;', function() { }, function() { });&quot;);
jsEnabledScript.setEscapeModelStrings(false); // do not HTML escape JavaScript code
add(jsEnabledScript);
</pre>
<p>And in your HTML</p>
<pre class="brush: plain;">
&lt;script type=&quot;text/javascript&quot; wicket:id=&quot;jsEnabledScript&quot;&gt;&lt;/script&gt;
</pre>
<h4>How to use?</h4>
<pre class="brush: java;">
final WebClientInfo clientInfo = (WebClientInfo) WebRequestCycle.get().getClientInfo();
boolean javascriptEnabled = clientInfo.getProperties().isJavaEnabled();
</pre>
<address>Note1: Put this code on one of your first pages like your login page, to do this callback only once.<br />
Note2: I really don&#8217;t have a clue why they called it isJavaEnabled() because Java != Javascript&#8230;.</address>
 <img src="http://www.volkomenjuist.nl/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=337" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.volkomenjuist.nl/blog/2010/01/19/how-to-check-whether-javascript-is-enabled-in-wicket/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript Compressor</title>
		<link>http://www.volkomenjuist.nl/blog/2009/04/12/javascript-compressor/</link>
		<comments>http://www.volkomenjuist.nl/blog/2009/04/12/javascript-compressor/#comments</comments>
		<pubDate>Sun, 12 Apr 2009 13:33:54 +0000</pubDate>
		<dc:creator>Stefanovich</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Compres]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.volkomenjuist.nl/blog/?p=278</guid>
		<description><![CDATA[When you download JQuery plugins there are often two versions. A &#8216;normal&#8217; version and a compressed (*.min.js) version. The purpose of this compressed file is to speed up your application, especially for slow speed internet connection. A very good website/tool to compress your Javascript files is http://dean.edwards.name/packer/. I tried a couple of files and it [...]]]></description>
			<content:encoded><![CDATA[<p>When you download JQuery plugins there are often two versions. A &#8216;normal&#8217; version and a compressed (*.min.js) version. The purpose of this compressed file is to speed up your application, especially for slow speed internet connection. A very good website/tool to compress your Javascript files is <a href="http://www.volkomenjuist.nl/blog/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2RlYW4uZWR3YXJkcy5uYW1lL3BhY2tlci8=">http://dean.edwards.name/packer/</a>. I tried a couple of files and it will reduce the JavaScript file size with 50%. </p>
<p><span id="more-278"></span><br />
When you need to debug your application it is not very usefull to use the compressed one but in production it really is. To switch very easy from the compressed version to the &#8216;normal&#8217; version and the other way around you can create a static variable where you define the location of the JavaScript file. Use the static variable to add the file to your page/header. Now you can switch versions (normal/compressed) by changing the static variable (in only one file).</p>
<p>JQuery.java:</p>
<pre class="brush: java;">
public static final String JQUERY_BASE = &quot;base/jquery-1.2.6.min.js&quot;;
</pre>
<p>(Wicket) Page:</p>
<pre class="brush: java;">
add(HeaderContributor.forJavaScript(JQuery.class, JQuery.JQUERY_BASE));
</pre>
 <img src="http://www.volkomenjuist.nl/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=278" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.volkomenjuist.nl/blog/2009/04/12/javascript-compressor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
