Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between browser tab and window

Tags:

javascript

In web browsers each window has its own JavaScript environment, with its own global object. But it looks like that opening a new tab in the same window also creates a different global object. Is this really true? What is the main differences between a new tab and a new window?

like image 339
koninos Avatar asked Jan 07 '16 11:01

koninos


People also ask

What is the meaning of a browser tab?

In computer software (e.g., Internet browser), a tab is a clickable area at the top of a window that shows another page or area. When a tab is clicked, the tab's contents are shown, and any other open tab is hidden. Tabs allow you to switch between options in a program, separate documents, or web pages.

What is the difference between new window and tab?

Opening a new tab means a running application a web browser here opens a new partition in itself to perform new tasks. New window means a copy of the application running will start running and it also has ability to create new partition spaces for tabs.

Is it better to have more windows or tabs?

Technically speaking, there is no difference between a browser window being displayed in a tab or a separate window. They both will share sessions and state (unless one window was opened using incognito mode). So, from this point it's just a matter of personal preference.

What is the difference between a page and a tab?

Sections are the tabs, while pages are the pieces of paper behind the tabs with all the information on them.


2 Answers

The only difference is how the window is presented to the user. Each Tab/Window has a totally separate DOM (Document Object Model) and JavaScript environment.

Most browsers will share Cookies and therefore Sessions between tabs and new windows. Some have an 'incognito' mode which prevents sharing of sessions between incognito and normal mode windows.

like image 147
Chris Wheeler Avatar answered Oct 03 '22 13:10

Chris Wheeler


Yes, if you open the same page in new window or tab, the global objects or variables will be created again and if you would have made some changes or modifications in tab A or window B and which had somehow changed the value of global objects or variables then it won't get reflected in tab C or window D unless you save it explicitly to the server and fetch it again from there. You cannot retain the value of global objects, they will be created again. Note that the session variables or objects will be same throughout.

Difference between tab and window

A tab is more or less same as a window. A window can contain several tabs and all session data and cookies are shared across all tabs and open window. It's better to open a lot of tabs than opening several windows because too many window becomes too cluttered to handle.

An incognito(private mode browsing) window doesn't share any information with regular window or any of the tabs in regular window, but all the tabs in an incognito window share the similar session data or cookies. A new instance of an incognito window will also behave as a new tab in incognito window and will share session data or cookies of that of incognito window.

like image 20
abhiagNitk Avatar answered Oct 03 '22 12:10

abhiagNitk