Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I have created a web application in SP 3.0 Central Administration and in the masterpage default.master added jquery code from SP designer.
XML
<HEAD>
...
<script type="text/javascript">
        $(document).ready(function(){
            $("#hide").click(function(){
                $("#myHeader").hide();
            });
            $("#show").click(function(){
                $("#myHeader").show();
            });
        });
    </script>
...
</HEAD> 


Its a simple test, a button hiding a header and another showing the header.
Problem:- From a client browser, by view source, I can get this code.

Is there anyway to restrict this or should I add the jquery code in some other pages like CORE.js?
Any help is appreciated.

Regards,
Sayan.
Posted

1 solution

 
Share this answer
 
Comments
Sayan Bera 8-Nov-13 3:41am    
Thanks for the response.
In 1st Link, by JavaScript Obfuscator i can achieve my reqd., but i able to decode the code also. In another approach, I didn't understand where should unloadJS() and unloadAllJS() be called.

Can you suggest any server side technique to do this?
ArunRajendra 10-Nov-13 22:06pm    
I am not jQuery expert but my guess it should be called as a last statement in document.ready(). As far as server side is concerned logically its not possible as the JavaScript will be executed at the browser. Hence it should be delivered at the client in the way the browser can understand.
Sayan Bera 11-Nov-13 8:18am    
Yes, its not possible with JavaScript. So encoding with JavaScript Obfuscator is good way.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900