answersLogoWhite

0

How do you close a browser window with HTML code?

Updated: 8/11/2023
User Avatar

Jinomunnar

Lvl 1
12y ago

Best Answer

You can't do it with HTML code.

You can use the Javascript method window.close() but for security reasons, you can only close a window if you opened it with Javascript. For instance

This code isn't worth much, because it's not connected to any event (so it opens a window that it immediately closes) but that's the basic idea.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

This would be done using javascript: <a href="javascript:window.close();">Close This Window</a>

This answer is:
User Avatar

Add your answer:

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

How does HTML code produce the form displayed in the browser?

As subtle distinction between HTML and browser is that HTML code does not produce the form; the browser produces the form. The browser interprets HTML code to determine how to display page content.


Written remarks in your HTML or CSS document which will not be displayed in the browser?

Comments are not displayed by the browser, but they can help document your HTML source code.


How do you install an HTML code in my website?

HTML code does not need to be installed. It needs to be written and run in a browser.


What is the code HTML for?

HTML is the code that tells a web browser how to display a web page on your computer screen.


Difference between the contents of the HTML file and what you see in the browser?

HTML or Hypertext Markup Language is code that can be used to create a website (among other things). HTML code is nothing but text, but, when viewed in a browser, can display images referred to in the code. If the HTML code is the ingredients of a cake, the browser shows the finished and fully decorated cake.


How do you write javascript code to close a browser window?

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();


What do you need to run HTML code?

web browser


How does HTML code produces the form displayed in the browser?

HTML code has special meanings for special tags. The &lt;form&gt; tag tells the browser that a form is being created.


What is used to change HTML code into an actual webpage?

You browser interprets HTML code to determine how to format content. The web server presents the page to the browser for consumption.


What is a HTML Reader?

A HTML Reader is kinda like a Web Browser. It shows you what the code will look like in the eyes of the Web Browser.


How do you display HTML code in windows?

HTML is a code language for markup. "Executing" would mean interpreting in this context, i.e. opening the file in a browser (displaying the page) rather than a text editor (displaying the code itself).


What is the difference between HTML and opera browser?

A browser is an application that is used to view web pages. Opera is the name of one browser. There are lots of other ones. HTML is the language that is used to create web pages. People write HTML code to create web pages. Browsers read the HTML code and then display the page in the browser.