473,320 Members | 2,054 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

javascript redirect. why is it bad?

In a web app I'm develing for PDA's, I'm using javascript for
navigation. (document.location = "url"). I've seen a bunch of posts
on the groups saying this is a bad idea, but no explanations why. Can
anyone explain?

Nov 18 '06 #1
9 2540
jeremy wrote on 18 nov 2006 in comp.lang.javascript:
In a web app I'm develing for PDA's, I'm using javascript for
navigation. (document.location = "url"). I've seen a bunch of posts
on the groups saying this is a bad idea, but no explanations why. Can
anyone explain?
I do not know why people say that.
If you programme for browsers that support it,
it seems all right.

However why not write the complete code:

document.location.href = "url"
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Nov 18 '06 #2
jeremy said the following on 11/18/2006 2:48 PM:
In a web app I'm develing for PDA's, I'm using javascript for
navigation. (document.location = "url"). I've seen a bunch of posts
on the groups saying this is a bad idea, but no explanations why. Can
anyone explain?
If you can ensure that every PDA (or any other UA) that uses your app
will have scripting enabled, then it's not a problem. The problem comes
when a UA either doesn't have script enabled, or, it doesn't have
scripting at all. Then your app is unusable.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 18 '06 #3
Evertjan. said the following on 11/18/2006 3:01 PM:
jeremy wrote on 18 nov 2006 in comp.lang.javascript:
>In a web app I'm develing for PDA's, I'm using javascript for
navigation. (document.location = "url"). I've seen a bunch of posts
on the groups saying this is a bad idea, but no explanations why. Can
anyone explain?

I do not know why people say that.
Because it's a bad idea.
If you programme for browsers that support it,
it seems all right.
Very true. But what happens when someone with a non-scriptable PDA comes
along?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 18 '06 #4
Ok, thanks for the info. Our app is restricted to certain users, and w
can require certain functionality on the platform they are using,
fortunately.

Randy Webb wrote:
jeremy said the following on 11/18/2006 2:48 PM:
In a web app I'm develing for PDA's, I'm using javascript for
navigation. (document.location = "url"). I've seen a bunch of posts
on the groups saying this is a bad idea, but no explanations why. Can
anyone explain?

If you can ensure that every PDA (or any other UA) that uses your app
will have scripting enabled, then it's not a problem. The problem comes
when a UA either doesn't have script enabled, or, it doesn't have
scripting at all. Then your app is unusable.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 18 '06 #5
Randy Webb wrote on 18 nov 2006 in comp.lang.javascript:
Evertjan. said the following on 11/18/2006 3:01 PM:
>jeremy wrote on 18 nov 2006 in comp.lang.javascript:
>>In a web app I'm develing for PDA's, I'm using javascript for
navigation. (document.location = "url"). I've seen a bunch of posts
on the groups saying this is a bad idea, but no explanations why. Can
anyone explain?

I do not know why people say that.

Because it's a bad idea.
>If you programme for browsers that support it,
it seems all right.

Very true. But what happens when someone with a non-scriptable PDA comes
along?
Nothing if you programme for browsers that support it [and have it switched
on], as I said. The non-scriptable PDA simply should be warned it is not
welcome.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Nov 18 '06 #6
jeremy wrote:
In a web app I'm develing for PDA's, I'm using javascript for
navigation. (document.location = "url"). I've seen a bunch of posts
on the groups saying this is a bad idea, but no explanations why. Can
anyone explain?
Not all browsers have javascript enabled, and javascript navigation can
make it pretty impossible for the search engines to crawl your site.

--
---------------------------------------------------------------------------
http://www.hunlock.com -- Permanently under construction (And proud of it!)
$FA
Nov 18 '06 #7
In message <aO********************@telcove.net>, Sat, 18 Nov 2006
15:05:56, Randy Webb <Hi************@aol.comwrites
>Evertjan. said the following on 11/18/2006 3:01 PM:
>jeremy wrote on 18 nov 2006 in comp.lang.javascript:
>>In a web app I'm develing for PDA's, I'm using javascript for
navigation. (document.location = "url"). I've seen a bunch of posts
on the groups saying this is a bad idea, but no explanations why. Can
anyone explain?
I do not know why people say that.

Because it's a bad idea.
>If you programme for browsers that support it,
it seems all right.

Very true. But what happens when someone with a non-scriptable PDA
comes along?

Then its user cannot use THAT METHOD OF navigation.

If, for example, every page contains an ordinary link to page
LINKAGES.HTM, and LINKAGES.HTM contains in plain HTML a structured list
of links to all other pages, then any user who can follow ordinary links
can access the whole site - and that includes search engines.

There's nothing wrong with adding javascript navigation as a luxury.

N.B. "using javascript for" != "using only javascript for".
Query, for anyone with a NON-FRAMES browser to hand - what does
<URL:http://www.merlyn.demon.co.uk/frames-1.htmshow?

With FRAMES working, one can go there and see my site framed; but one
can de-frame at any time, and re-frame from any(?) HTML page. This the
use of frames is analogously a reader-selected option, if supported by
the browser.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20 ; WinXP.
Web <URL:http://www.merlyn.demon.co.uk/- FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm- also batprogs.htm.
Nov 19 '06 #8
Dr J R Stockton said the following on 11/19/2006 8:50 AM:
In message <aO********************@telcove.net>, Sat, 18 Nov 2006
15:05:56, Randy Webb <Hi************@aol.comwrites
>Evertjan. said the following on 11/18/2006 3:01 PM:
>>jeremy wrote on 18 nov 2006 in comp.lang.javascript:

In a web app I'm develing for PDA's, I'm using javascript for
navigation. (document.location = "url"). I've seen a bunch of posts
on the groups saying this is a bad idea, but no explanations why. Can
anyone explain?
I do not know why people say that.
Because it's a bad idea.
>>If you programme for browsers that support it,
it seems all right.
Very true. But what happens when someone with a non-scriptable PDA
comes along?


Then its user cannot use THAT METHOD OF navigation.
And the OP stated: "I am using javascript for navigation". That does
*not* imply an HTML fall back.
If, for example, every page contains an ordinary link to page
LINKAGES.HTM, and LINKAGES.HTM contains in plain HTML a structured list
of links to all other pages, then any user who can follow ordinary links
can access the whole site - and that includes search engines.
And anybody that writes code like this:

<a href="somePage.html" onclick="location.href = this.href;return
false">Go to some page</a>

Isn't writing bad code, they are an idiot!
There's nothing wrong with adding javascript navigation as a luxury.
No there isn't, but the OP indicated that was the *only* navigation
provided and that is a bad idea.
N.B. "using javascript for" != "using only javascript for".
Re-read the thread John. The OP clearly stated it was the only
navigation, just not in as many words.
Query, for anyone with a NON-FRAMES browser to hand - what does
<URL:http://www.merlyn.demon.co.uk/frames-1.htmshow?
Shows a link to your homepage.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 19 '06 #9
In comp.lang.javascript message <g4********************@telcove.net>,
Sun, 19 Nov 2006 18:55:54, Randy Webb <Hi************@aol.comwrote:
>Dr J R Stockton said the following on 11/19/2006 8:50 AM:
>In message <aO********************@telcove.net>, Sat, 18 Nov 2006
15:05:56, Randy Webb <Hi************@aol.comwrites
>>Evertjan. said the following on 11/18/2006 3:01 PM:
jeremy wrote on 18 nov 2006 in comp.lang.javascript:

In a web app I'm develing for PDA's, I'm using javascript for
navigation. (document.location = "url"). I've seen a bunch of posts
on the groups saying this is a bad idea, but no explanations why. Can
anyone explain?
I do not know why people say that.
Because it's a bad idea.

If you programme for browsers that support it,
it seems all right.
Very true. But what happens when someone with a non-scriptable PDA
comes along?
Then its user cannot use THAT METHOD OF navigation.

And the OP stated: "I am using javascript for navigation". That does
*not* imply an HTML fall back.
Nor does it imply the absence thereof.

I use a car to go to a certain place; I do so regularly. But that does
not mean that I never go there by other means. On Tuesday 7th, I wanted
to be there earlier, so I walked there.
My article, in indicating how alternative navigation can be provided,
acknowledges that without alternative navigation there would be no
navigation for those not script-capable.
>If, for example, every page contains an ordinary link to page
LINKAGES.HTM, and LINKAGES.HTM contains in plain HTML a structured list
of links to all other pages, then any user who can follow ordinary links
can access the whole site - and that includes search engines.

And anybody that writes code like this:

<a href="somePage.html" onclick="location.href = this.href;return
false">Go to some page</a>

Isn't writing bad code, they are an idiot!
You're the first person to have written such code in this branch of this
thread.
>Query, for anyone with a NON-FRAMES browser to hand - what does
<URL:http://www.merlyn.demon.co.uk/frames-1.htmshow?

Shows a link to your homepage.
I hope not; my home page is file c:\*\*.htm on this PC (and, ere long,
that should need to be in the plural). I dare say that you mean that it
shows a link to my Web site's Home Page. Thanks; that's what it should
do.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms, & links.
Plaintext, quoting : see <URL:http://www.usenet.org.uk/ukpost.html>
Do not Mail News to me. Before a reply, quote with ">" or "" (SoRFC1036)
Nov 20 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ryann | last post by:
I hate javascript looking for help. I am trying to pass hidden fields around without showing a query string in the address bar. e.g. formA.asp not formA.asp?var1=blah&var2=blah I have...
0
by: Michelle Keys | last post by:
I am trying to call a print function to print a string from a database using javascript. Which is RC_DATA of Varchar2(2500). This is a javascript is not being used. I have a thing that needs to...
9
by: SHarris | last post by:
Hello, In our new intranet ASP.NET project, two requirements are that the browser accept cookies AND JavaScript. We are requiring the use of Internet Explorer 6+. 1. Using C# in an ASP.NET...
3
by: Shapper | last post by:
Hello, I am working on an ASP.NET/VB web site. I have several links including menu links. Considerer a want to load a page named page.aspx. I can do it using javascript. Or using this code:...
3
by: TJ | last post by:
Hi, I would like to ask something to user after user submits the form... I know I can ask user whehter they want to submit the form or not using client-script code such as onClick or onSubmit by...
2
by: SteveSu | last post by:
Hi! I want to make a postback when the user hits the escape-button on the keyboard and redirect the user to another page. But the response.redirect does not work for me in this "context". I´m...
8
by: Taras_96 | last post by:
Hi everyone, We' ve come to the conclusion that we wish the user to be directed to an error page if javascript is disabled <enter comment about how a webpage shouldn't rely on javascript here :)...
1
by: rkagrawal | last post by:
I am not sure if this is the right forum to post about this problem , but , i just want to discuss a problem i recently encountered. I was developing a page in ASP , where i came across a problem....
2
by: Seth Williams | last post by:
In the middle of my event handler (for a button), I have an if/then statement (using vb.net): if (whatever) then strScript="<script ....... strScript &= alert('This is an alert') strscript...
2
by: Rahina | last post by:
I am working in Dreamweaver 8, and I have created a simple form: http://www.realmofmystery.com/app.html This is a free website I am doing for some friends, so nothing fancy. And, I learned web...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.