Closed Bug 275632 Opened 20 years ago Closed 20 years ago

JavaScript document.open doesn't work

Categories

(Firefox :: General, defect)

1.0 Branch
x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: corporal, Assigned: bugzilla)

Details

Create a link with a simple JavaScript like this:
<A HREF="#" ONCLICK="document.location = gotourl('blog');">blog</A>

The gotourl function is a simple string parser, which returns an URL including
the string passed as the parameter. The return value is irrelevant. Let's say it
returned "http://www.blog.com".

Now comes the surprise. If I click the link, it displays no error, but doesn't
do anything. It takes five or six clicks, and suddenly it does what it's
supposed to, opens the new document. But now the Back button is not working. It
isn't disabled, but it doesn't do anything.
The summary and the details don't match, but in any case I cannot reproduce the 
problem using the latest nightly:

<script>
function gotourl(site)
{
  return "http://www." +site +".com";
}
</script>

<A HREF="#" ONCLICK="document.location = gotourl('blog');">blog</A>
Works for me. Personally, I'd use onclick="document.location =
gotourl('blog');return false;" to be sure I didn't run into trouble with the
default handler (well, I'd do it completely differently, but if I *had to*).
Please reopen if you have actual code that you want to attach or link to that
should work but doesn't.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.