Jump to content
Nytro

secure.js

Recommended Posts

Posted

Better and more secure JavaScript! Because!

Just include…

<script src="secure.js"></script>

…and reap the benefits of really safe and secure JavaScript!

;;;;;;;;;;  // semicolons make things securer, trust me on this;;;;;;;;;;
;;;;;;;;;; ((((( function(){
function log(message){
if ('console' in this && 'log' in console) {{{{
console.log(message);
}}}}
}


// first, test if JavaScript is available
document.write('<script>;;;;;var __secure = true;;;;;</script>');
if (!__secure) {{{{
return log("secure.js: security alert: whoa, no JavaScript available!!1!");
}}}}


// sanity check that JavaScript actually works
if (!(1+1 == 2)) {{{{
return log("secure.js: security alert: nice try, fake JavaScript!!1!");
}}}}


// before declaring strict mode, which requires a string,
// test if Strings are available
if (!'String' in this) {{{{
return log("secure.js: security alert: strings are not available!!1!");
}}}}


// improve security by using strict mode
"use strict";


return log("secure.js: everything is really secure now!");
;;;;;;;;;; } )))))()
;;;;;;;;;;
;;;;;;;;;; // some more security padding

Acest post este un...

Sursa: https://github.com/madrobby/secure.js/blob/master/secure.js

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...