Any possible way to use js code on js Disabled browser

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
vinoth
Forum Contributor
Posts: 113
Joined: Thu Aug 02, 2007 3:08 am
Location: India
Contact:

Any possible way to use js code on js Disabled browser

Post by vinoth »

HI All..
I am using most of the designing stuff on my site using Javascript, But the user disabled the Javascript on browser,
The designing Js stuff was not working...

I don't know is it possible or not? to make use the JS code on JS diabled Browser.

Anybody suggest or providing ideas to make use the javascript code on javascript disabled Browsers.


Thanks in advance.

Vinoth..
kryles
Forum Contributor
Posts: 114
Joined: Fri Feb 01, 2008 7:52 am

Re: Any possible way to use js code on js Disabled browser

Post by kryles »

wouldn't that kind of defeat the purpose of disabling JS?

Just send them to different pages coded in just PHP, or tell them to enable JS to make your site work properly.

Maybe there is a work around that'll work for you, but still.........
User avatar
Sekka
Forum Commoner
Posts: 91
Joined: Mon Feb 18, 2008 10:25 am
Location: Huddersfield, West Yorkshire, UK

Re: Any possible way to use js code on js Disabled browser

Post by Sekka »

You need to read into Unobtrusive programming when it comes to JavaScript.

To save you some aggro, here are two options you could implement.

JS Redirect

Create a page. This page has a notice on it saying something along the lines of 'You need to enable JavaScript to use MyTool'. On this page you will add a JavaScript redirect to the actual tool page. If they have JS enabled, they will be redirected to the tool, if not, they will stay on the warning.

Unobtrusive

When your tool page first loads, it needs to assume the user doesn't have JS enabled. So, by default, the page won't have any JS functionality. This could mean the tool is within a hidden DIV and instead a notice is displayed like in the previous example.

What you then do is attach all the functionality to the page using JavaScript itself. For example, you may have a button on your page with an onclick="someFunction()". You wouldn't embed this within the HTML. Instead, you would add the onclick to the button using JavaScript itself.

Once you'd setup all your functionality, you'd then hide the notice and unhide the tool.

This is a very basic overview of Unobtrusive, but do you get what I am trying to tell you?
User avatar
Sekka
Forum Commoner
Posts: 91
Joined: Mon Feb 18, 2008 10:25 am
Location: Huddersfield, West Yorkshire, UK

Re: Any possible way to use js code on js Disabled browser

Post by Sekka »

And FYI, this is a JavaScript/HTML question, not PHP.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Any possible way to use js code on js Disabled browser

Post by Jonah Bron »

If javascript is disabled, the only thing you can do, is tell them to enable it:

Code: Select all

alert("Sorry, you must enable javascript to view this page");
:rofl:
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: Any possible way to use js code on js Disabled browser

Post by Zoxive »

PHPyoungster wrote:If javascript is disabled, the only thing you can do, is tell them to enable it:

Code: Select all

alert("Sorry, you must enable javascript to view this page");
:rofl:
Hard to tell if you were serious or the "rofl" smiley was to give it away but.. Its kind of pointless trying to alert when javascript is disabled. :mrgreen:

Code: Select all

<noscript>
Sorry, you must enable javascript to view this page.
<noscript>
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Any possible way to use js code on js Disabled browser

Post by Jonah Bron »

Glad someone gets it. :lol:
Post Reply