<?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>GUYA.NET &#187; 10.1</title>
	<atom:link href="http://blog.guya.net/tag/10-1/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.guya.net</link>
	<description>Flash and Everything Else</description>
	<lastBuildDate>Tue, 29 Nov 2011 15:42:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Kiss And Tell What Is The User Browsing Mode</title>
		<link>http://blog.guya.net/2010/01/25/kiss-and-tell-what-is-the-user-browsing-mode/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=kiss-and-tell-what-is-the-user-browsing-mode</link>
		<comments>http://blog.guya.net/2010/01/25/kiss-and-tell-what-is-the-user-browsing-mode/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 23:30:34 +0000</pubDate>
		<dc:creator>guya</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Flash General]]></category>
		<category><![CDATA[Flash Security]]></category>
		<category><![CDATA[Safeloper]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[10.1]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Private Browsing]]></category>

		<guid isPermaLink="false">http://blog.guya.net/?p=253</guid>
		<description><![CDATA[To know if the user is currently in normal or private browsing mode can be valuable info for any ads providers and spammers, but not only. With the upcoming Flash Player 10.1 (currently in beta 2) there are many welcome &#8230; <a href="http://blog.guya.net/2010/01/25/kiss-and-tell-what-is-the-user-browsing-mode/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>To know if the user is currently in normal or private browsing mode can be valuable info for any ads providers and spammers, but not only.</p>
<p>With the upcoming <a title="Adobe Flash Player 10.1" href="http://labs.adobe.com/technologies/flashplayer10/">Flash Player 10.1</a> (currently in beta 2) there are many welcome improvements. One of these is the support for private browsing as described in <a title="Private browsing in Flash Player 10.1" href="http://www.adobe.com/devnet/flashplayer/articles/privacy_mode_fp10.1.html" target="_blank">this article</a>.</p>
<p>For me, one thing that  immediately jumped out from the aforementioned article was that, unintentionally, with the aid of the new Beta Flash Player, websites can tell which mode the user is currently using.</p>
<p><em>“…in private browsing with default settings, the default local storage limit in private browsing is 1 MB…”</em></p>
<p><em>“To protect user privacy, there is no way for developers to tell whether their content is handling normal or private LSOs. Flash Player handles local storage data in the same way.”</em> <strong>No it doesn’t!</strong></p>
<p>Not only I can tell about the current status of the Flash Player browsing mode, but now I can tell about the browser itself since Flash inherit its mode from the browser.</p>
<p>Load a small enough SWF (less than 215 x 138) so it won’t ever show the settings dialog.</p>
<p>Now, kiss (sorry for the cheesiness <img src='http://blog.guya.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ) the local storage with data greater than 128kb. If it reject the kiss then you&#8217;re in normal browsing mode, if it accept it you can tell it’s a private mode.</p>
<p>It’s that easy, load this blog post in Private Mode with <strong>Flash Player 10.1 beta 2 installed</strong> and you’ll see the difference:</p>
<p><code>[kml_flashembed movie="http://blog.guya.net/wp-content/uploads/2010/01/KissAndTell.swf" width="400" height="35" /]</code></p>
<p>The solution is simple, private and normal modes should behave <strong>completely</strong> the same. In this case the local storage capacity should be the same. Lower both to 128kb or up both to 1MB. Which one is better, you may ask?! I’ll tell you latter <img src='http://blog.guya.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>The good thing is that Flash Player 10.1 is still in beta 2 so I’m sure it’ll be fixed for by the final release.</p>
<p>The source code is below:</p>
<pre lang="Actionscript" colla="-">
package {
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.NetStatusEvent;
	import flash.net.SharedObject;
	import flash.net.SharedObjectFlushStatus;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	import flash.utils.getTimer;
	import flash.utils.setTimeout;

	/**
	 * This class will tell the current browsing mode of the user
	 * Tested with Flash Player 10.1 beta 2
	 * for more info go to:
	 * http://blog.guya.net
	 */

	[SWF(backgroundColor="#FFFFFF", width="400", height="35")]
	public class KissAndTell extends Sprite
	{
		private var _tf:TextField;

		public function KissAndTell()
		{
			initStage();
			createTF();
			setTimeout(saveData, 300);
		}

		private function initStage():void
		{
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
		}

		//try to save 140kb into the local storage
		private function saveData():void
		{
			var kissSO:SharedObject = SharedObject.getLocal("kissAndTell");
			kissSO.data.value = getDataString(140);

			var status:String;

			try
			{
				status = kissSO.flush();
				kissSO.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
			}
			catch(ex:Error)
			{
				trace("Save failed");
			}

			//If we can save more than 128kb then we're in Private Mode
			if (status &#038;&#038; status == SharedObjectFlushStatus.FLUSHED)
			{
				setPrivateText();
            }
		}

		//Listening to this event just to prevent exception on debug players
		private function netStatusHandler(event:NetStatusEvent):void
		{
			trace("event.info.code: " + event.info.code);
		}

		private function setPrivateText():void
		{
			_tf.text = "Private Browsing Mode";
			_tf.backgroundColor = 0xAA2222;
		}

		private function createTF():void
		{
			_tf = new TextField();
			_tf.autoSize = TextFieldAutoSize.LEFT;
			_tf.defaultTextFormat = new TextFormat("Arial, Verdana", 20, 0xFFFFFF, true, null, null, null, null, null, 10, 10);
			_tf.text = "Normal Browsing Mode"
			_tf.backgroundColor = 0x22AA22;
			_tf.background = true;
			addChild(_tf);
		}

		private function getDataString(kb:int):String
		{
			var t:int = getTimer();
			var word:String = "GUYA.NET_GUYA.NET_GUYA.NET_GUYA.NET_GUYA.NET_GUYA.NET_GUYA.NET_GUYA.NET_GUYA.NET_GUYA.NET_GUYA.NET_";
			var count:int;
			var a:Array = new Array();
			var lenNeeded:int = kb * 1024;
			while(count * word.length &lt; lenNeeded)
			{
				a.push(word);
				count++;
			}

			var ret:String = a.join("");
			trace("time for generating " + kb + "kb: " + String(getTimer() - t) + " ml");
			return ret;
		}

	}
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.guya.net/2010/01/25/kiss-and-tell-what-is-the-user-browsing-mode/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

