John Cooper
John Cooper

Reputation: 7631

Global instance in JavaScript

I have an instance of my class..

var controller = new (function () {
     // Contains lot of methods
});

Is it possible that i can make the instance of this Object across all Windows. Without including this file in other pages, i can call the instance of this Object every where.

Upvotes: 0

Views: 273

Answers (1)

Robert Massaioli
Robert Massaioli

Reputation: 13477

Without including this file in other pages, i can call the instance of this Object every where.

No you cannot. There are no cross window Javascript objects as far as I know and I assume that there would not be for security reasons. Though I guess parent windows can talk to child windows. So you could append something to a parent window and pass data that way but I would not recommend it.

Upvotes: 2

Related Questions