Archive for the ‘ javascript ’ Category

Can you hack it? Right Click Script

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (2 votes, average: 8 out of 10)
Loading ... Loading ...

As my previous post Enable / Disable Right Click Script I mention how to disable and enable right click in a web browser. However i find out a script which is unable to hack it. Put below into your html code

<body oncontextmenu="return false;">

For Example

<html><title>Can you hack the right click?</title>
<body oncontextmenu="return false;">  
javascript:void(document.oncontextmenu=null)
<br>
<br>
Script above is not going to enable this back anymore, 
do you know how to hack it?
</body>
</html>

Please access here to try hack this script. If you know how enable it back, please inform me. Thanks

Enable / Disable Right Click Script

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 6 out of 10)
Loading ... Loading ...

Sometime i really no idea why so many webmasters using disable right click to protect their own content. Here are disable right click script i found from web

 
<script language="JavaScript">
<!-- 
//edit this message to say what you want
var message="Function Disabled"; 
 
function clickIE() {if (document.all) {alert(message); return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {alert(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
 
document.oncontextmenu=new Function("return false")
// -->
</script>

Please visit below site also
1) http://www.dynamicdrive.com/dynamicindex9/noright.htm

2) http://www.users.totalise.co.uk/~bigoleg/javascript/javascript_disable_right_click.html

Right click is mean less, because this is so easy to enable it back. Just copy following script and put into address bar of the browser. Right click will be enable again

javascript:void(document.oncontextmenu=null)

Even i do not have a script on hand, i also can “CTRL + U” or click View-> Page Source in Firefox to view the source code, ya it may be can stop some newbies to copy image but it is just no point to do it, this is so easy to hack.

How to check directory file size on linux (Solution)

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 2 out of 10)
Loading ... Loading ...

hmm… linux whatever also in command line, it really make me uncomfortable, i even need to issue a command to check a directory size.

du -lh

P.S
always issue -h to display file size in human readable format

check-directory-size-on-linux

We can check summary of a directory by issuing

du -sh <directory>

JavaScript Call Funtion After Page Load

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (3 votes, average: 6.33 out of 10)
Loading ... Loading ...

Usually we can call a function during page on load with following two methods.

<body onload="happycode() ;">

or

<script>
window.onload=happycode ;
</script>

But how we can call a javascript function after a page load? I solved it by using a very simple method, it did exactly what i want and call after page and content loaded. Just add an onload function at the end of the body.

<html>
....
<body>
...
 
<script>
//call after page loaded
window.onload=happycode ; 
</script>
</body>
</html>

Javascript Highlight search result

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1 out of 10)
Loading ... Loading ...

Tedpavlic created a very easy to understand and useful client site javascript highlight.

Here i briefly describe how to use it, please visit website above for details

1)Include following code

<style>
<!-- 
    SPAN.searchword { background-color:yellow; }
    // -->
</style>
<script src="http://links.tedpavlic.com/js/searchhi_slim.js" 
type="text/javascript" language="JavaScript"></script>

2) Call it localSearchHighlight(’searchstr’)

<script language="javascript">
window.onload=localSearchHighlight('search search');
</script>

3)Result

4)Simple, Done. Thanks Tedpavlic provided a good javascript highlight code.