Script to close browser window

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

eddparsons
Ebase User
Posts: 53
Joined: Wed Jan 02, 2013 4:23 pm
Location: Lyndhurst, Hampshire
Contact:

Script to close browser window

#1

Postby eddparsons » Fri Aug 01, 2014 1:13 pm

Hi,

Is it possible to run a script from within a form that closes the browser window? The form is being launched in a new window from a web page and if the user clicks cancel we just want to get rid of the window.

window.close seems like it should do the trick but doesn't work in a server side script - if it needs to be in a client script could someone explain how to set this up and assoicate this with a button click?

Regards,
Edd
0 x

eddparsons
Ebase User
Posts: 53
Joined: Wed Jan 02, 2013 4:23 pm
Location: Lyndhurst, Hampshire
Contact:

#2

Postby eddparsons » Fri Aug 01, 2014 1:35 pm

Answered my own question - just adding window.close() to a click event under HTML element properties does the job.
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#3

Postby Jon » Fri Aug 01, 2014 1:47 pm

You should probably also add "return false;" which stops the button submitting to the server.

Regards
Jon
0 x

eddparsons
Ebase User
Posts: 53
Joined: Wed Jan 02, 2013 4:23 pm
Location: Lyndhurst, Hampshire
Contact:

#4

Postby eddparsons » Fri Aug 01, 2014 1:58 pm

Ok thanks Jon.
0 x


Who is online

Users browsing this forum: No registered users and 24 guests