Open new popup chrome window without tab section - javascript

Sometimes surfing the web with chrome,I encounter a website or web app,when click on an <a> or <button> element it opens a new popup browser window which does not have tab section while I do not have any Chrome Extension installed:
main window:
popup new window:
My question is,How to do this using JavaScript?
Thanks.

Please see tutorial here: http://www.w3schools.com/jsref/met_win_open.asp
<script>
function myFunction() {
window.open("http://www.w3schools.com","_blank",
"toolbar,scrollbars,resizable,top=500,left=500,width=400,height=400");
}
</script>

<!DOCTYPE html>
<html>
<body>
<button onclick="openTheWindow()">open window</button>
<script>
function openTheWindow() {
var myWindow = window.open("", "", "width=800,height=800");
}
</script>
</body>
</html>

Related

new window screenshot failed

I am trying to screenshot page created in new window, not popup but in new tab. Code now is simple. And page can be created.
However my goal is to make Full page screenshot of it. I used in Chrome - "Full Page Screen Capture " and in Firefox top screen captures - all of them greyed out - meaning impossible to capture entire page.
screenshot fialed
Code:
<!doctype html>
<head>
<title>New Window Screenshot</title>
</head>
<body>
<script>
function newWindow() {
var w = window.open('', '_blank');
w.document.write('Loading preview...');
}
</script>
<button onclick="newWindow()">Click me</button>
</body>
</html>
code
Please, no need of html2canvas. I just need to lunch some screencapturers. And my guess, well I don't know... Please help!

window.open Named Window is opening new window on each click

On launching a window using window.open(), a new instance of browser is getting launched on button click every time, even if the calling function is having named window.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
function OpenNamedWindow() {
var w2 = window.open("http://stackoverflow.com", "myWindow", "width=500px;height=500px");
}
</script>
<input type="button" onclick="OpenNamedWindow();" value="Launch App" />
</body>
</html>
After launching the page when I try to access window.name, it shows empty.
I did some search and looks like cross domain is causing the issue.
How can I load the page in same instance instead of launching a new browser window all the time?
This is a trick
function openInNewTab(url) {
var win = window.open(url, '_blank');
win.focus();
}
But even this, perhaps should not work in all browser depending on users configuration
This topic is still here in stackoverflow.
try to check it by yourself at the following link
Open a URL in a new tab (and not a new window) using JavaScript
It opens only one window at a time:
var window_name = null; // global
...
function open_new_window() {
if (window_name && !window_name.closed) {
window_name.close();
window_name = window.open(....);
}

IE11 on WIN 8.1 : window.open with the same name is opening new popup window

When running the below HTML page it is opening two popup windows. It is not the case with previous versions of IE. When window.open call is made with the same window name that has already opened, it should return the reference to the opened window. But in IE11 it is opening another new window.
<html>
<head>
<script type="text/javascript">
window.open("http://www.google.com", "test", "resizable=no,scrollbars=yes,width=260,height=225");
window.open("http://www.google.com", "test", "resizable=no,scrollbars=yes,width=260,height=225");
</script>
</head>
</html>
This behavior is not happening, if you not mentioned a url. (See below html page). Below html page is launching only one popup window.
<html>
<head>
<script type="text/javascript">
window.open("", "test", "resizable=no,scrollbars=yes,width=260,height=225");
window.open("", "test", "resizable=no,scrollbars=yes,width=260,height=225");
</script>
</head>
</html>
When we provide url or navigate to url window is losing its name. If you try to get the popup window name using window.name it is returning empty string.
It is happening only in Windows 8.1 and IE 11 and not happening in Windows 7 and IE11.
Are there any tweaks I need to do to make this work in IE11?
Update:
It seems to be IE bug. IE team is investigating it.
https://connect.microsoft.com/IE/feedback/details/797964/ie11-win-8-1-window-open-with-the-same-name-is-opening-new-popup-window#details
Update 2:
It is happening only if Internet Explorer runs in elevated mode.
Please try this.. this will check the window is still open or closed..
<script type="text/javascript">
var myWindow = null;
if(!myWindow || (myWindow && myWindow.closed)){
myWindow = window.open("http://www.google.com", "test", "resizable=no,scrollbars=yes,width=260,height=225");
}
else{
myWindow.location.href = 'http://www.google.com';
}
</script>

Javascript redirect - New Window

I'm trying to create a re-direct using Javascript from inside a blank iframe that will direct to a URL inside a new window or tab.
More specifically, I'm trying to make a Facebook tab point to my company's webpage rather than load the page inside the tab's iframe which is not the same width as our web page.
Here is the redirect script I already have but it doesn't open the URL in a new window.
<script language="JavaScript">
<!--Redirect to 75th page
var time = null
function move() {
window.location = 'http://philmontscoutranch.org/Camping/75.aspx'
}
timer=setTimeout('move()',0000)
//-->
</script>
Ok - This snippet will open a new window when the page loads but Chrome's pop-up blocker blocked it. I didn't think about this until now. Maybe I could have it load in a light window?
<script language="JavaScript">
<!--Redirect to 75th page
var time = null
function open_win()
{
window.open("http://philmontscoutranch.org/Camping/75.aspx", "_blank");
}
timer=setTimeout('open_win()',0000)
//-->
</script>
Here you go: Jsfiddle Example
function opennewtab(url){
var win = window.open(url, '_blank');
}
<html>
<head>
<script>
function open_win()
{
window.open("http://philmontscoutranch.org/Camping/75.aspx", "_blank");
}
</script>
</head>
<body>
<input type="button" value="Open Window" onclick="open_win()">
</body>
</html>
Source

javascript: Open an URL from an window.open page back in the original page

I'm opening a smaller web browser window from the "main" web page. The "child" window contains links like the following...
<a onclick="javascript:window.open('http://someplace.com/','_blank');">Someplace</a>
But instead of using target "_blank" I would like to use the name of the original, "main" web page window and open the links back in that window. Any suggestions how to do that?
follow this example to help you solve your problem:
<!DOCTYPE html>
<html>
<head>
<script>
function openWin()
{
myWindow=window.open('','','width=200,height=100');
myWindow.document.write("<p>This is 'myWindow'</p>");
myWindow.focus();
myWindow.opener.document.write("<p>This is the source window!</p>");
}
</script>
</head>
<body>
<input type="button" value="Open 'myWindow'" onclick="openWin()" />
</body>
</html>
Instead of window.open, you can use:
<a onclick="javascript:window.opener.location.href = 'http://someplace.com/';">Someplace</a>

Categories