user884424
user884424

Reputation: 583

How can I close a window with javascript using setTimeout?

onclick of a button creates a window, add to UI, I want to close this window using javascript ? please advice how to close this window using javascript after some timeout?

Button  button= new Button("load Content",e->{
        Window  sub= new Window();
        UI.getCurrent().addWindow(sub);
    });

Upvotes: 0

Views: 733

Answers (1)

Mayank Pandeyz
Mayank Pandeyz

Reputation: 26258

Try this:

setTimeout("window.close()", 5000);

// here 5000 ms refers to 5 seconds

Upvotes: 1

Related Questions