window.open

window.open() works different on AJAX success [duplicate]

血红的双手。 提交于 2019-11-27 13:04:24
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: window.open(url) different behavior - same code, different timing It will be more easy for me to explain the problem if I just show you that example -> http://jsfiddle.net/RU2SM/ As you can see there are 2 buttons, one called'AJAX' and one called 'Direct'... So if you click on 'Direct' it opens window (new tab on Chrome) but if I try to make window.open() on AJAX success handler, it doesn't work same way. I'm

Window.Open with PDF stream instead of PDF location

五迷三道 提交于 2019-11-27 12:49:34
问题 Based on the question Open PDF in new browser full window, it looks like I can use JavaScript to open a new window with a PDF file with the following code: window.open('MyPDF.pdf', '_blank'); I'd like to do so on a return trip from the server by adding a byte array instead of the file name to use as the URL location in window.open I'm currently returning PDF files like this: Response.Clear(); Response.ContentType = "application/pdf"; Response.BinaryWrite(pdfByteArray); Response.Flush(); Is

How to set a file name using window.open

流过昼夜 提交于 2019-11-27 11:19:25
I'am trying to download temporary result calculated by JavaScript. Say I have a string str , I want to download a file contains str and named it as data.csv , I'm using the following code: window.open('data:text/csv;charset=utf-8,' + str); The file can be successfully downloaded, but how can I name the file data.csv automatically rather than set the name by hand each time? You can achieve this using the download attribute for <a> elements. For example: <a href="1251354216241621.txt" download="your-foo.txt">Download Your Foo</a> This attribute indicates that the file should be downloaded

window.open behaviour in chrome tabs/windows

谁说胖子不能爱 提交于 2019-11-27 09:29:20
I have a small bit of javascript intended to open two or more tabs. This works fine in FF and IE, but chrome opens the second one in a new window instead of tab. It isn't dependant on the url as I've tried it with two identical url's. First opens in tab, second one in new window. Here's my code snippet: for(var i=0 ; i<sites.length ;i++) { window.open(sites[i].Url); } Bagelzone Ha'bonè Chrome automatically opens a URL in a new tab only if it's user generated action, limited to one tab per user action. In any other case, the URL will be opened in a new window (which, BTW, is blocked by default

Window.Open POST

夙愿已清 提交于 2019-11-27 09:08:17
I have a link which when clicked I open a window with window.open like below. window.open("edit.jsp?clientId=" + clientId + "&eventId=" + eventId , 'height=600,width=800,scrollbars=1,location:no,menubar:no,resizable=1,status:no,toolbar:no'); I dont want the parameter to pass here instead I want to something like post so people cant copy url . You cannot trigger a javascript popup and then force a post request. Three options: Trigger a POST form with target="_blank" using javascript (but this doesn't allow you to disable interface elements such as the menu bar). Open a popup locally, but don't

press a button on external site with javascript

南楼画角 提交于 2019-11-27 07:21:48
问题 is there a way to press a button on external site with javascript and/or jquery? Like I open a new window like this: windowObjectReference = window.open("http://some_site.html","name"); Then I want to press a button on this site. Something like this: windowObjectReference.button.click(); Or: name.button.click(); 回答1: It would be a huge security violation if a browser would let you do that from the script placed on your own website. So, no, this cannot be done, and should not be possible . But

how to prevent reopening new window using jQuery?

╄→尐↘猪︶ㄣ 提交于 2019-11-27 07:03:18
问题 I've recently posted a new question in How jQuery can prevent reopening a new window?. At that post, I mentioned to my need for something on F2 key. Now I want to ask another question similar to the question above; This time for clicking on a link. I have a link that opens a new window using window.open . I want to prevent user to reopening new window when he clicks on the list if the previous window is still opened. What is your suggestion? 回答1: You could do: var childWin; function winOpen

window.open() on a multi-monitor/dual-monitor system - where does window pop up?

旧街凉风 提交于 2019-11-27 06:53:45
When using javascript window.open() on a multi-monitor system, how do you control which monitor, or where in the display space the popup opens? It seems out of control to me and otherwise random in it's behavior. BrianH Result of "window.open dual-screen" search revealed this fancy nugget: Dual Monitors and Window.open "When the user clicks on a link that opens a new window using window.open. Make the window appear on the same monitor as its' parent." // Find Left Boundry of the Screen/Monitor function FindLeftScreenBoundry() { // Check if the window is off the primary monitor in a positive

Find window previously opened by window.open

大憨熊 提交于 2019-11-27 04:22:12
问题 We've got the following situation, running from a single domain: Page A uses window.open() to open a named window (a popup player). window.open() gives page A a reference to the window. User now reloads page A. The reference to the named window is lost. Using window.open() to "find" the window has the unfortunate side effect of reloading it (undesirable). Is there any other way to get a reference to this window? 回答1: Try this: var playerUrl = 'http://my.player...'; var popupPlayer= window

Open new window after a click event not working in Safari, Chrome

梦想与她 提交于 2019-11-27 02:46:37
问题 I'm trying to open a new window like so: $('#wrapper').click(function() { window.setTimeout(function() { //alert('hi'); window.open("http://example.com", "ExternalLinks", "resizable=yes, scrollbars=yes, status=yes"); }, 1000); }); This works in Firefox, but not in Chrome or Safari (so far, I've just tested on a Mac). The alert() works in all browsers, so there seems to be something preventing the window.open from executing in Safari/Chrome. Furthermore, if I remove the setTimeout and just