Rommeo Posted December 9, 2008 Share Posted December 9, 2008 Hello .. i m a newbie about php programming. The websites i always visit uses JS for giving link and for some other stuff. So i m wondering why i need to use JS for the web pages ? As far as i know it's cause of some security reasons. But why? I mean what can attackers do a website without Js used? And what are the benefits of javascript ? is it really necessary ? would be glad to hear your ideas. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted December 9, 2008 Share Posted December 9, 2008 there is absolutely no reason that you MUST use javascript. in fact, most of the time, javascript is overused and misused. but, most people use javascript to make the experience easier for the user. a great example is at hulu.com. while watching a video on that site, you can fill in the login script at the top of the page. it uses javascript to submit the credentials, meaning the page doesn't have to reload, leading to your movie not being interrupted. Quote Link to comment Share on other sites More sharing options...
xangelo Posted December 15, 2008 Share Posted December 15, 2008 The problem with javascript, is that when you first learn how to use it, you go overboard with it. But perhaps that is just a learning process. As you use it more and more, you'll begin to see it's place in things. For example, JS is a great way to do some quick form validation. Checking if all fields are filled out, making sure that fields are filled with the right values and immediately displaying any errors. Another example, is like the one posted above, while viewing some content, javascript can quietly send some information off to the database and update your content without reloading the page. The biggest thing is knowing that most times, javascript is not a requirement, it is an add-on. Quote Link to comment Share on other sites More sharing options...
Adam Posted December 15, 2008 Share Posted December 15, 2008 Also just to add, you have it the wrong way round with security. JavaScript is not secure in any way. After reading a quick tutorial / article, any developer could hack JS! A Quote Link to comment Share on other sites More sharing options...
xangelo Posted December 15, 2008 Share Posted December 15, 2008 Also just to add, you have it the wrong way round with security. JavaScript is not secure in any way. After reading a quick tutorial / article, any developer could hack JS! A Quite right MrAdam. Infact, I'd say that using javascript primarily as ways of doing validation, you're site would be more vulnerable. Since JS is run clientside (in the browser), anyone can access the script and see how it runs. You should never place sensitive information in Javascript. Quote Link to comment Share on other sites More sharing options...
CroNiX Posted December 15, 2008 Share Posted December 15, 2008 Quite right MrAdam. Infact, I'd say that using javascript primarily as ways of doing validation, you're site would be more vulnerable. Since JS is run clientside (in the browser), anyone can access the script and see how it runs. You should never place sensitive information in Javascript. Always make sure your site runs 100% before javascript is added. All validation etc must work with php. After that, you can use JS to spruce your site up with clientside validation and ajax/etc for a better user experience, but everything must function 100% if JS is disabled. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.