/    Sign up×
Community /Pin to ProfileBookmark

<noscript> tag, is it bullet proof?

I have three JSP pages that use JavaScript as data validation. I was using <noscript> tag to detect if JS was disabled and display an error. It works if user has disabled JS. However, if user came to first page with JS enabled, filled out the form and before submiting page disabled JS — <noscript> does not really work. One the action page I have <noscript> detect, but in does not really work since it displays the <noscript> message, but executes the rest of the page as well.

Receiving Page:

[code]
<html>
<noscript>
<span class=”hsText”>No JavaScript decteted!</span>
<br>
JavaScript must be enabled to use this program. Please click
<a href=”http://www.shopassistant.net/support/scriptenable/”>here</a> to enable JavaScript.
</noscript>
<link rel=”stylesheet” type=”text/css” href=”include/styles.css”>
<script language=”javascript” src=”include/scripts.js”></script>
<body marginheight=”0″
marginwidth=”0″
leftmargin=”0″
rightmargin=”0″
topmargin=”0″
bgcolor=”#ffffff”>
<%
// Do some JSP stuff here
%>
</body>
</html>
[/code]

Is there any workaround for this?

thanks,
webtekie

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@AdamGundryNov 10.2003 — Yes, the workaround is to do your data validation (and everything else) on the server-side, where you do not have to worry about what the user's browser supports.

Adam
Copy linkTweet thisAlerts:
@webtekieauthorNov 10.2003 — But then JavaScript form validation is useless, unless you write the same routine on server-side...I read that MS .NET allows you to execute JavaScript on server-side so that's a nice workaround I guess.
Copy linkTweet thisAlerts:
@AdamGundryNov 10.2003 — Yes, IMHO Javascript form validation is useless - it cannot be relied on, because 13% of users have JS disabled and others could work around it. Hence if you really need validation, you need to do it server-side.

I believe ASP (and ASP.NET) allow you to write code in JS that executes on the server.

Adam
Copy linkTweet thisAlerts:
@CharlesNov 10.2003 — [font=georgia]There's nothing wrong with JavaScript, as long as one doesn't rely upon it - and client side verification is a good thing. You don't want all of your users to have to submit the form and wait for a response to find out that there's something wrong with the form. A proper form is validated both client and server side. To cut processing time on the server, one can use JavaScript to set the value of a hidden form field or even to change the "action" attribute of the form so that it goes to a server side script that doesn't bother with redundant verification.

And as some of the 13% of users who do not use JavaScript cannot use it because of some disability, using the NOSCRIPT element to present an error message is an insult and a cruel one at that.[/font]
×

Success!

Help @webtekie spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.10,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...