answersLogoWhite

0


Best Answer

If you want to close the current window, use window.close() or simply close()

If you want to close a window that is stored in a JavaScript variable, apply the method close() to it. For example:

var myWindow=window.open("http:\/\/www.example.com/");

myWindow.close();

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write javascript code to close a browser window?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write an ASP code that will display the source code of the web page in the browser window?

Write an ASP code that will dislplay the source code of the web page in the Browser window.


What is the difference between Javascript and Jquery?

JavaScript is a scripting language that is mainly used within a web browser. Jquery is a library of javascript code that can be used together with your javascript program. A set of functions that can preform common tasks is provided, which will reduce the amount of code that you have to write yourself.


How can you pass a JavaScript value into a PHP file?

JavaScript lives in the browser, PHP lives on the server.To pass a value from JavaScript to a PHP page, you can eitherdo an HTML form submituse AJAXIn both cases, the value is sent to the server and you write your PHP to handle it and send a response.The important thing is that the JavaScript value won't be available in PHP when you first generate the page, creating the page and handling the value submitted from the browser are two distinct steps.


How do run a program html javascript?

Open a file in a text editor. Then save is as my_custom_name.html . Then paste whatever html code you have, or simply write some. Then, in the head, either write <script type="text/javascript"> //write code here </script> or you can link to an external javascript page. http://www.w3schools.com/js/js_whereto.asp then just open the html document with a browser. You can do this by (on a mac) right clicking, and selecting 'open with', and then choose a browser. You can also do it by doing file:///Users/your_user/your_file_path/my_custom_name.html. eg. file:///Users/jake/Documents/example_folder/an_additional_folder/example.html.


How do you write a javascript?

go to notepad and write Javascript code and save it as .js and then import it into a page with a src tag


Can you run JavaScript which you write in Netscape in Internet Explore?

Netscape is very outdated and is not used any more. i believe they are now Mozilla Firefox, but now days the internet browsers that you can use all should be javascript ready. i know mozilla firefox is javascript ready and the most up to date internet explore is javascript ready. i dont believe there is a difference in the programming i believe on whatever browser you have it should still render.


What is the difference between script and scriptlet?

"script" is an HTML tag used to include JavaScript on a web page. Example: <HTML> <body> <script type="text/javascript"> document.write("hi there"); // javascript interpreted by the browser </script> </body> </HTML> "Scriptlet" is a JSP construct used to include Java in a JSP page. Example: <HTML> <body> <% // this is a scriptlet response.getWriter().write("hi there"); // Java executed on the server %> </body> </HTML> Here the result (an HTML document with the text "hi there") is the same in both cases, but the mechanisms are different - Javascript runs in the browser (any browser), while the JSP scriptlet is executed on the server and needs a server with JSP support. See related links.


How do you write HTML codes and javascript events together in your HTML kit?

You need to write the HTML code in the tag format. If you want to write JavaScript put it in <script> tag.


How to use Javascript to write to the local filesystem?

For security reasons, regular JavaScript scripts in web pages are not allowed to write to the local file system.


Any javaScript for auto filling forms in the internet?

Not really. In theory, if you could write a cookie from a very common domain, then it might work. Form auto-fill is generally perpetrated by the browser itself.


What languages can you write a Google Apps script on?

JavaScript


Registry edit window close after couple of second?

please write questions using proper grammar