hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Disable Javascript
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

Disable Javascript

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 02-22-2004, 11:53 PM
mr5 mr5 is offline
Junior Guru Wannabe
 
Join Date: Jan 2004
Posts: 72

Disable Javascript


I protect my page by Javascript.
Can visitore disable Javascript in IE or Netscape...?

Thanks for support.

Reply With Quote


Sponsored Links
  #2  
Old 02-23-2004, 12:21 AM
stdunbar stdunbar is offline
Web Hosting Master
 
Join Date: Aug 2002
Location: Superior, CO, USA
Posts: 633
Certainly in the Netscape series - Mozilla and Firefox. I think in IE also.

Don't bother. It won't work. See the great number of other threads on this topic - you cannot protect your HTML code from somebody who really wants to see it.

Reply With Quote
  #3  
Old 02-23-2004, 12:35 AM
luki luki is offline
Web Hosting Master
 
Join Date: Apr 2003
Location: Los Angeles, CA
Posts: 723
This was posted recently, and it's quite good
http://www.vortex-webdesign.com/help/hidesource.htm

Reply With Quote
Sponsored Links
  #4  
Old 02-23-2004, 04:41 AM
mr5 mr5 is offline
Junior Guru Wannabe
 
Join Date: Jan 2004
Posts: 72
Ok, I think I can protect my HTML source code by many methods, example: use encrypt program...

#2 Question: now I don't need to protect my source code but I don't want visitors disable my Javascript, example I use Javascript to compel visitor input some fields... If they can disable Javascript I think I must check information inputed by visitors by server script like PHP or ASP. Notice that they can not save as my page and change HTML, Javascript code because I have also protect my page by Session (I use PHP):

<?
if(!isset($_SESSION['protect'])) exit(); //
...
?>

So if they save the web space, $_SESSION['protect'] will empty.

Thanks,

Reply With Quote
  #5  
Old 02-23-2004, 04:55 AM
desman desman is offline
Aspiring Evangelist
 
Join Date: Jan 2003
Location: Australia
Posts: 365
You cannot protect HTML it’s just that simple…. No Right click’s, JS encryption, just doesn’t work. If somebody wants your images they will get it.

Some people code there own browsers (in house) to use get methods and pull your site down, images and HTML. The only thing they cannot access is the server side code unless they have root/ftp access.


Last edited by desman; 02-23-2004 at 05:00 AM.
Reply With Quote
  #6  
Old 02-23-2004, 07:15 AM
mr5 mr5 is offline
Junior Guru Wannabe
 
Join Date: Jan 2004
Posts: 72
Thanks, desman. But I think you don't understand what I mean.

Example, I have this file :

form.htm

Quote:
<html>
<head><title></title>
<script>
<!--
function validate(){
if (sendform.name.value == ""){
alert("Please input your name");
}
else sendform.submit();
}
</script>
</head>
<body>
<form method=post action="send.php" name="sendform">
<input name="name" type="text" id="name" size="40" maxlength="50">
<input type="button" onClick="validate()" value="Submit">
</form>
</body>
</html>
OK, they can save this file and change the code:

<input name="name" type="text" id="name" size="40" maxlength="100000">
<input type="button" value="Submit">

They also deleted onClick="validate()" to ignore Javascript.

My question here is: if they don't save the file, can they disable Javascript? I.e they can send the form without input any thing.

Reply With Quote
  #7  
Old 02-23-2004, 07:20 AM
Wullie Wullie is offline
Web Hosting Master
 
Join Date: Feb 2004
Location: Scotland
Posts: 2,830
Quote:
Originally posted by mr5
If they can disable Javascript I think I must check information inputed by visitors by server script like PHP or ASP.

So if they save the web space, $_SESSION['protect'] will empty.
JS can be used to validate without another hit to the server, but you should always double check the input with a server-side solution.

Have you tried saving the code, then opening a browser to the page while you submit the data? This should easily bypass your session check.

As has been mentioned, you cannot in any way protect your HTML or any other client-side language, other than creating your own browser or plug-in and forcing users to use that to see your site.

Reply With Quote
  #8  
Old 02-23-2004, 08:02 AM
mr5 mr5 is offline
Junior Guru Wannabe
 
Join Date: Jan 2004
Posts: 72
That means they can not "turn off" JS if don't save the page.

But I don't know why I must check the input with a server-side solution if I can protect my website with session. Because the PHP code "protect with SESSION" is too long so I can not post here, but it likes that:

// only one page to input info and send. test.php
PHP Code:
<?
session_start
();
if(
$page=="send"){
if(isset(
$_SESSION['security']))
echo(
"Your name is $name"); 
else echo(
"false");
}
else {
$_SESSION['security']=1;
?>
<script>
<!--
function validate(){
if (sendform.name.value == ""){
alert("Please input your name"); 
}
else sendform.submit();
}
</script>
<form method=post action="[b]test.php?page=send[/b]" name="sendform">
<input name="name" type="text" id="name" size="40" maxlength="50">
<input type="button" onClick="validate()" value="Submit"> 
</form>
<? ?>
I think this page is safe. Notice that $_SESSION[''] does not exist in a new browser's window, that means if you open another IE's window the $_SESSION[''] does not exist.

Try my test.php. While open the test.php, open another new window and input in address bar: test.php?page=send&name=Jame

You'll see: "false"

So however they can save the page but they can not harm my website

Reply With Quote
  #9  
Old 02-23-2004, 03:06 PM
stdunbar stdunbar is offline
Web Hosting Master
 
Join Date: Aug 2002
Location: Superior, CO, USA
Posts: 633
mr5,
Never, ever, ever trust what the client sends you. Yes, it's a pain to check all the input on the backend. Yes, Javascript can do some of that for you. I'd still encourage you to use Javascript for simple typos but you really don't want to trust the client.

Reply With Quote
  #10  
Old 02-23-2004, 05:32 PM
desman desman is offline
Aspiring Evangelist
 
Join Date: Jan 2003
Location: Australia
Posts: 365
Oh ok sorry, your best bet is to validate server side, you won’t have a problem.

PHP Code:
ASP
Sub BindEvents
()
    
Set YourForm.YourField.YourEvents("OnValidate") = GetRef("YourForm_YourField_OnValidate")
End Sub

Function YourForm_YourField_OnValidate() 

    If 
CStr(YourForm.YourField.Value) = "" Then _
        YourForm
.YourField.Errors.addError("You must enter a value")

End Function

-----------------------------
PHP
function BindEvents()
{
    global 
$YourForm;
    
$YourForm->YourField->YourEvents["OnValidate"] = "YourForm_YourField_OnValidate";
}

function 
YourForm_YourField_OnValidate()
{
    
$YourForm_YourField_OnValidate true;

    global 
$YourForm;
    if (!
strlen($YourForm->YourField->GetText()))
    {
        
$YourForm->YourField->Errors->addError("You must enter a value");
    }

    return 
$YourForm_YourField_OnValidate;


Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Facebook's Recently Acquired Mobile App Platform Parse Launches Web Hosting for Developers Web Hosting News 2013-05-08 10:49:17
Google Plans to Disable Online Revocation Checks in Future Chrome Versions Web Hosting News 2012-02-09 13:26:57
UK Police e-Crime Unit Shuts Down More Than 2,000 Fake Online Stores Web Hosting News 2011-11-23 21:50:33
Browsers Disable DigiNotar After Rogue Certificate Used in Gmail Attack Web Hosting News 2011-08-30 14:20:17
World IPv6 Day a Success, say Organizers and Web Hosts Web Hosting News 2011-06-09 15:53:10


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?