O'Reilly logo

Eloquent JavaScript by Marijn Haverbeke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Basic Web Scripting

We will now walk through some of the things that a JavaScript environment in a web browser provides and look at some simple things that can be done with client-side programming.

The window Object

One of the first widespread uses of JavaScript was the open method of the window object. It takes a URL as an argument and will open a new window showing that URL.

var comicwindow = window.open("http://www.pbfcomics.com");

If you try that nowadays, your browser will probably block the new window from opening. Web programmers, especially those trying to get people to pay attention to advertisements, have abused this window.open method so much that by now, it is considered really bad style and not allowed by default. It still has its uses, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required