Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #8781

Re: javascript: and about: Protocols Not Working

From "Jukka K. Korpela" <jkorpela@cs.tut.fi>
Newsgroups comp.lang.javascript
Subject Re: javascript: and about: Protocols Not Working
Date 2011-12-02 19:57 +0200
Organization A noiseless patient Spider
Message-ID <jbb3hf$vbn$1@dont-email.me> (permalink)
References (2 earlier) <timstreater-5A797A.12374601122011@news.individual.net> <4ed77afb$0$6643$9b4e6d93@newsspool2.arcor-online.net> <4ed77ef4$0$6636$9b4e6d93@newsspool2.arcor-online.net> <jba5t2$6pt$1@dont-email.me> <4ed8e3fd$0$6641$9b4e6d93@newsspool2.arcor-online.net>

Show all headers | View raw


2011-12-02 16:43, Martin Honnen wrote:

>> legacy code that uses an href attribute with
>> javascript: URL _and_ target="_blank".
[...]
> With the target being set, the browser first opens a new tab and in the
> contents of that tab evaluates the Javascript code. As there is no
> content at all in that tab the function call "openUp()" to a function
> named "openUp" fails as no function is defined at all in the new tab.

Sounds like a simple explanation, and Firefox indeed shows an error 
message about openUp being undefined.

> At least that is how Mozilla and Opera do it, Chrome does what you want.

Well, this wasn't really my code, or even my code. :-) Just an 
interesting observation. And although the fix would be simple, it seems 
to be legacy code that nobody wants to take care of.

> So none of that is really a viable approach.

Indeed, if someone wants to open a web page in a new window with 
specific properties, it is surely much better to set up a normal link, 
then add an onclick handler that creates a window for the link to use, 
so that the page works fine when JavaScript is off and in a 
cross-browser way when it is on. But I'm afraid there's a lot of code 
around that uses javascript: URLs in href attributes instead of any 
robust approach.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

javascript: and about: Protocols Not Working Gene Wirchenko <genew@ocis.net> - 2011-11-30 18:28 -0800
  Re: javascript: and about: Protocols Not Working Martin Honnen <mahotrash@yahoo.de> - 2011-12-01 11:53 +0100
    Re: javascript: and about: Protocols Not Working Richard Cornford <Richard@litotes.demon.co.uk> - 2011-12-01 04:29 -0800
    Re: javascript: and about: Protocols Not Working Tim Streater <timstreater@greenbee.net> - 2011-12-01 12:37 +0000
      Re: javascript: and about: Protocols Not Working Martin Honnen <mahotrash@yahoo.de> - 2011-12-01 14:02 +0100
        Re: javascript: and about: Protocols Not Working Martin Honnen <mahotrash@yahoo.de> - 2011-12-01 14:19 +0100
          Re: javascript: and about: Protocols Not Working "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-12-02 11:31 +0200
            Re: javascript: and about: Protocols Not Working Martin Honnen <mahotrash@yahoo.de> - 2011-12-02 15:43 +0100
              Re: javascript: and about: Protocols Not Working "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-12-02 19:57 +0200
    Re: javascript: and about: Protocols Not Working Richard Cornford <Richard@litotes.demon.co.uk> - 2011-12-01 04:03 -0800
    Re: javascript: and about: Protocols Not Working Gene Wirchenko <genew@ocis.net> - 2011-12-01 12:14 -0800
      Re: javascript: and about: Protocols Not Working Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@spamyourself.com> - 2011-12-02 10:01 +0100
        Re: javascript: and about: Protocols Not Working Gene Wirchenko <genew@ocis.net> - 2011-12-02 12:35 -0800
          Re: javascript: and about: Protocols Not Working Tim Streater <timstreater@greenbee.net> - 2011-12-02 20:39 +0000
            Re: javascript: and about: Protocols Not Working Gene Wirchenko <genew@ocis.net> - 2011-12-02 13:56 -0800
              Re: javascript: and about: Protocols Not Working Tim Streater <timstreater@greenbee.net> - 2011-12-02 23:40 +0000
              Re: javascript: and about: Protocols Not Working Dr J R Stockton <reply1148@merlyn.demon.co.uk> - 2011-12-03 19:13 +0000
            Re: javascript: and about: Protocols Not Working Jake Jarvis <pig_in_shoes@yahoo.com> - 2011-12-02 23:01 +0100
  Re: javascript: and about: Protocols Not Working Arno Welzel <usenet@arnowelzel.de> - 2011-12-04 15:46 +0100
  Re: javascript: and about: Protocols Not Working Bwig Zomberi <zomberiMAPSONNOSPAM@gmail.invalid> - 2011-12-06 11:41 +0530

csiph-web