Making a site JavaScript dependent - pros/cons?

Tarzan

New Member
Messages
66
Reaction score
0
Points
0
Javascript is a popular way of validating forms, generating popups, hiding menus, changing a value for submission etc.
You can do really neat things on the client side my using some clever javascripting. But what about browsers that aren't javascript enabled? Or users that turn their interpreters off?

Do you use Javascript on your sites? Why or why not? Should all Javascript actions be redundant? Since javascript enabled browsers are in vast majority, one could argue that you wouldn't loose to many visitors by implementing a little beautiful javascripting. What are your opinions?
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
In my opinion it is best to use JavaScript if you feel this is the best option for your site, but it's always a good idea to make a backup system in case the browser doesn't support JavaScript or the user disabled it.
 

VPmase

New Member
Messages
914
Reaction score
0
Points
0
I use ajax for my site and a lot of Javascript. It makes the site more organized in some areas, in my case the links. Ajax just makes the bandwidth usage lower so I love it :)
But in some cases people don't allow javascript so I would have to make a backup system for non-JS people. It takes a while to make one so I just have this:
PHP:
<noscript><? $javascript = false ?></noscript>
...
<?
if(!$javascipt){
echo "You have disabled javascript for your web browser so it. It is difficulty to navigate the site with out it... I suggest you re-enable it.";
}
?>
Then I use the $javascript var to change the links if necessary or change the AJAX too.
 
Last edited:

marshian

New Member
Messages
526
Reaction score
9
Points
0
I use ajax for my site and a lot of Javascript. It makes the site more organized in some areas, in my case the links. Ajax just makes the bandwidth usage lower so I love it :)
But in some cases people don't allow javascript so I would have to make a backup system for non-JS people. It takes a while to make one so I just have this:
PHP:
<noscript><? $javascript = false ?></noscript>
...
<?
if(!$javascipt){
echo "You have disabled javascript for your web browser so it. It is difficulty to navigate the site with out it... I suggest you re-enable it.";
}
?>
Then I use the $javascript var to change the links if necessary or change the AJAX too.

How can this work?
PHP:
<? $javascript = false ?>
gets executed before the page is send to the user, so in that page, $javascript is always false...
<noscript>-tags only work within the browser.
I suggest you use javascript to find out about the javascript... For example, standard give a non-js page, but with a little piece of JS that requests a page from the server, the server creates a session and stores the user has js enabled. Next page the user visits, you either send the non-js page (with the little piece of js) (if the session-thingie didn't happen), or the AJAX page (if the session-thingie did happen)
 

blu3fire

New Member
Messages
14
Reaction score
0
Points
0
In my opinion creating websites full of javascript/dhtml effects isn't good way-some older computers have problems with rendering bunch of JS. Making whole site on AJAX/jQuery isn't good too because many people block JS so you must create alternative for them (it's double work). Pay attention on validatng forms... EVERYTIME use serverside validation too ]:->
Why? Client-side validation can be easy avoided by smart programmer so your website can be easy hacked.
 

tnl2k7

Banned
Messages
3,131
Reaction score
0
Points
0
While JavaScript allows for amazing development advances with regards to the web, you'll find that some (not many, granted but still some) people don't have JavaScript enabled for security reasons or just don't use a browser which supports it. For this reason, I'd do as much as possible at the server end (using PHP) and making sure that you have a backup for anything done with JS in straight old HTML.

I've managed to use _no_ JS on my games arcade so far, and I intend to continue this record. I will have to start using it soon to disable form inputs and stuff (stop double clicking of the submit button ;)) but I'll still allow other users to use the forms.

Just watch how much you use JS though.

-Luke.
 
T

themasterrocker

Guest
You could do you're page in Javascript as main page and then if someone hasn't got javascript enabled you could have a redirect for them maybe? P.S i'm not too sure on how javascript works :p
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
You could do you're page in Javascript as main page and then if someone hasn't got javascript enabled you could have a redirect for them maybe? P.S i'm not too sure on how javascript works :p

You could do it the other way around: make your index page redirect to page b.php, while you redirect it using javascript to a.php. If the user has no javascript, it will be redirected to b.php, but if he does, he gets redirected to a.php. It's possible but this is not really a great idea.
 
T

themasterrocker

Guest
You could do it the other way around: make your index page redirect to page b.php, while you redirect it using javascript to a.php. If the user has no javascript, it will be redirected to b.php, but if he does, he gets redirected to a.php. It's possible but this is not really a great idea.

That's what i was saying Marshian, stop trying to show off :p lol:thefinger

I'm joking really Marshian. lol
 
Top