(How) Can a web site determine if Safari Private Browsing is turned on?
On iOS, HTML5's local storage is not available in private browsing mode, which means you can detect it by attempting to save something to local storage and catching the exception with the following JavaScript:

try { localStorage.test = 2; } catch (e) {
  alert('You are in Private Browsing mode');
}


Modified from https://stackoverflow.com/a/17741714/

On OS X, there's not really a canonical method, but this should provide some useful information:


Can web sites detect whether you are using private browsing mode? –Security.SE


If you're looking for implementation guidance, you should probably try Stack Overflow instead