javascript redirect. why is it bad?

Discussion in 'Javascript' started by jeremy, Nov 18, 2006.

  1. jeremy

    jeremy Guest

    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?
     
    jeremy, Nov 18, 2006
    #1
    1. Advertisements

  2. jeremy

    Evertjan. Guest

    jeremy wrote on 18 nov 2006 in comp.lang.javascript:
    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., Nov 18, 2006
    #2
    1. Advertisements

  3. jeremy

    Randy Webb Guest

    jeremy said the following on 11/18/2006 2:48 PM:
    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 Webb, Nov 18, 2006
    #3
  4. jeremy

    Randy Webb Guest

    Evertjan. said the following on 11/18/2006 3:01 PM:
    Because it's a bad idea.
    Very true. But what happens when someone with a non-scriptable PDA comes
    along?
     
    Randy Webb, Nov 18, 2006
    #4
  5. jeremy

    jeremy Guest

    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.
     
    jeremy, Nov 18, 2006
    #5
  6. jeremy

    Evertjan. Guest

    Randy Webb wrote on 18 nov 2006 in comp.lang.javascript:
    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., Nov 18, 2006
    #6
  7. jeremy

    pcx99 Guest

    Not all browsers have javascript enabled, and javascript navigation can
    make it pretty impossible for the search engines to crawl your site.
     
    pcx99, Nov 18, 2006
    #7

  8. 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.htm> show?

    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.
     
    Dr J R Stockton, Nov 19, 2006
    #8
  9. jeremy

    Randy Webb Guest

    Dr J R Stockton said the following on 11/19/2006 8:50 AM:
    And the OP stated: "I am using javascript for navigation". That does
    *not* imply an HTML fall back.
    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!
    No there isn't, but the OP indicated that was the *only* navigation
    provided and that is a bad idea.
    Re-read the thread John. The OP clearly stated it was the only
    navigation, just not in as many words.
    Shows a link to your homepage.
     
    Randy Webb, Nov 19, 2006
    #9
  10. In comp.lang.javascript message <>,
    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.
    You're the first person to have written such code in this branch of this
    thread.


    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.
     
    Dr J R Stockton, Nov 20, 2006
    #10
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.