new-window

Javascript window.print() in chrome, closing new window or tab instead of cancelling print leaves javascript blocked in parent window

我怕爱的太早我们不能终老 提交于 2019-11-27 13:01:36
In the application I work on, we have several different places a user can print from. In all these cases we are using the same workflow of opening a new window(or tab), writing whatever we need to print to the document of the new window, and then we call $(w.document).ready(function () { w.focus(); w.print(); w.close(); }); The issue I'm seeing is that in Chrome, if I close the tab or window that is opened for the print preview instead of clicking the cancel button, Chrome is still blocking the javascript on my parent window. It is similar to the issue described here: Google Chrome blocks ajax

Set a callback function to a new window in javascript

╄→гoц情女王★ 提交于 2019-11-26 22:22:54
Is there an easy way to set a "callback" function to a new window that is opened in javascript? I'd like to run a function of the parent from the new window, but I want the parent to be able to set the name of this particular function (so it shouldn't be hardcoded in the new windows page). For example in the parent I have: function DoSomething { alert('Something'); } ... <input type="button" onClick="OpenNewWindow(linktonewwindow,DoSomething);" /> And in the child window I want to: <input type="button" onClick="RunCallbackFunction();" /> The question is how to create this OpenNewWindow and

How to handle the new window in Selenium WebDriver using Java?

狂风中的少年 提交于 2019-11-26 20:26:51
This is my code: driver.findElement(By.id("ImageButton5")).click(); //Thread.sleep(3000); String winHandleBefore = driver.getWindowHandle(); driver.switchTo().window(winHandleBefore); driver.findElement(By.id("txtEnterCptCode")).sendKeys("99219"); Now I have the next error: Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to find element with id == txtEnterCptCode (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 404 milliseconds. Any ideas? It seems like you are not actually switching to any new window. You are supposed

Refresh/navigate current page while opening/downloading file in new tab/window

[亡魂溺海] 提交于 2019-11-26 18:35:32
问题 I have a button which opens a new tab with a generated pdf-file. However, after I click on the button, I want to navigate to another page. That means, after clicking on the button i want to open a new tab with the pdf and navigate to another page on the initial tab. I am using primefaces p:commandButton and tried with onclick="window.location.href='www.google.de'" but it does not work. However onclick="window.lalert('www.google.de')" does work. This is my code: <h:form id="transForm" target="

Javascript window.print() in chrome, closing new window or tab instead of cancelling print leaves javascript blocked in parent window

别来无恙 提交于 2019-11-26 18:14:41
问题 In the application I work on, we have several different places a user can print from. In all these cases we are using the same workflow of opening a new window(or tab), writing whatever we need to print to the document of the new window, and then we call $(w.document).ready(function () { w.focus(); w.print(); w.close(); }); The issue I'm seeing is that in Chrome, if I close the tab or window that is opened for the print preview instead of clicking the cancel button, Chrome is still blocking

Can I create links with 'target=“_blank”' in Markdown?

為{幸葍}努か 提交于 2019-11-26 17:02:23
Is there a way to create a link in Markdown that opens in a new window? If not, what syntax do you recommend to do this. I'll add it to the markdown compiler I use. I think it should be an option. As far as the Markdown syntax is concerned, if you want to get that detailed, you'll just have to use HTML. <a href="http://example.com/" target="_blank">Hello, world!</a> Most Markdown engines I've seen allow plain old HTML, just for situations like this where a generic text markup system just won't cut it. (The StackOverflow engine, for example.) They then run the entire output through an HTML

System.Windows.Forms.WebBrowser open links in same window or new window with same session

只愿长相守 提交于 2019-11-26 16:29:36
问题 When using the .NET WebBrowser control how do you open a link in a new window using the the same session (ie.. do not start a new ASP.NET session on the server), or how do you capture the new window event to open the URL in the same WebBrowser control? 回答1: I just spent an hour looking for the answer, so I though I would post the results here. You can use the SHDocVwCtl.WebBrowser_V1 object to capture the NewWindow event. NOTE: Code from http://www.experts-exchange.com/Programming/Languages

Execute terminal command from python in new terminal window?

瘦欲@ 提交于 2019-11-26 11:50:34
The goal here is to run a new python file in a new shell from and existing python file in an existing shell. Say i have two files, aaa.py and bbb.py. Lets say for simplicity that all aaa.py does is... subprocess.call('python bbb.py', shell=True) ...and lets say that bbb.py does is... print 'It worked' Now the goal is to run aaa.py in terminal 1 and get it to launch bbb.py in terminal 2. I would expect something like the command below to exist, but can't figure it out. subprocess.call_in_new_window('python bb.py', shell=True) There's no way to do this in general from a shell. What you have to

Set a callback function to a new window in javascript

旧城冷巷雨未停 提交于 2019-11-26 08:18:46
问题 Is there an easy way to set a \"callback\" function to a new window that is opened in javascript? I\'d like to run a function of the parent from the new window, but I want the parent to be able to set the name of this particular function (so it shouldn\'t be hardcoded in the new windows page). For example in the parent I have: function DoSomething { alert(\'Something\'); } ... <input type=\"button\" onClick=\"OpenNewWindow(linktonewwindow,DoSomething);\" /> And in the child window I want to:

How to handle the new window in Selenium WebDriver using Java?

こ雲淡風輕ζ 提交于 2019-11-26 07:39:25
问题 This is my code: driver.findElement(By.id(\"ImageButton5\")).click(); //Thread.sleep(3000); String winHandleBefore = driver.getWindowHandle(); driver.switchTo().window(winHandleBefore); driver.findElement(By.id(\"txtEnterCptCode\")).sendKeys(\"99219\"); Now I have the next error: Exception in thread \"main\" org.openqa.selenium.NoSuchElementException: Unable to find element with id == txtEnterCptCode (WARNING: The server did not provide any stacktrace information) Command duration or timeout: