Jump to content

Why do i need JS


Rommeo

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.