window.open

window.open returns null and fails in inline script but works from console

99封情书 提交于 2019-11-29 13:10:44
I'm using Smarty template system. One of its features is posibility to output script that generates debug information for every page. Here you can see an example of generated code: <script type="text/javascript"> //<![CDATA[ setTimeout(function() { //Attempt to fix the issue with timeout var _smarty_console = window.open("about:blank","md5hash","width=680,height=600,resizable,scrollbars=yes"); console.log(_smarty_console); //Trying to log it if(_smarty_console!=null) { _smarty_console.document.write("<!DOCTY... lots of HTML ...<\/html>\n"); _smarty_console.document.close(); } }, 5000); //]]> <

window.open() add a rel=“nofollow” attribute

旧城冷巷雨未停 提交于 2019-11-29 08:42:29
Is there a way to add a rel="nofollow" attribute to the window.open() Javascript function? Or is that any way to have Google not follow a link created by Javascript or jQuery. Update Also, this will be a product for a client and I will not have access to their files. Any changes the robot.txt or .htaccess are off the table. Google can read javascript links In HTML5, the nofollow link type may only be used with a and area elements. Since you are already using javascript.. (and can not access the robots.txt or .htaccess files), there is no reason why you couldn't use a normal (but hidden) <a

How to get element and html from window.open js function with jquery

亡梦爱人 提交于 2019-11-29 07:15:13
I am trying to open a popup like this: $('#btn').click(function () { var popup = window.open('mypage.php', '_blank', 'width=500,height=500'); var dom = popup.document.body; for (i in dom) { console.log(dom[i]); } }); Now what I want to do is to get the html from the popup window and also be able to use maybe a jQuery function from the window.opener (the page that opened the popup) PS. In the console there are a lot of things printed but no html source. Use this to try: http://jsfiddle.net/JRqTy/ Thanks in advance. Try: var html = popup.document.documentElement.outerHTML EDIT The window is not

How to disconnect JavaScript popup from opener

删除回忆录丶 提交于 2019-11-29 07:09:31
I'm opening a popup from my main page with code like this: <a href="http://external.domain.tld/" onclick="window.open(this.href, '_blank', 'width=512,height=512,left=200,top=100');return false"> Open popup </a> This works fine, but my problem is that the document which is loaded in the popup window has the permission to change the location of the opener window. This even works when the document in the popup is from a different domain. It has no permission to read the location but it is allowed to change the location. I don't want that. I want the popup to be completely disconnected from my

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

随声附和 提交于 2019-11-28 20:40:36
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 sure that the problem is from AJAX but I have no idea how to fix it. Will appreciate any good ideas. Thanks This works like a charm: // Direct window.open() $('

Html javascript to open new window and close current window

扶醉桌前 提交于 2019-11-28 13:26:30
I have a popup window and in that page I have the following code in the body. <a href="http://www.example.com" target="_blank" onClick="javascript:window.close()"><img src="...something"/></a> The purpose is to have this popup window close when a user clicks on the image link, and to open a new page and be directed to http://www.example.com . It works in IE and Chrome, but not in Firefox. The popup window closes but no new window is opened. Any ideas? Yes, I can repro this - interesting. setTimeout works around it: onClick="javascript: setTimeout(window.close, 10);" I can only guess that once

press a button on external site with javascript

二次信任 提交于 2019-11-28 13:00:30
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(); 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... If both sites belong to you (you have access to their code), you can pass a parameter (eg. as a hash

Javascript window.open() passing args

大兔子大兔子 提交于 2019-11-28 12:42:25
问题 I am trying to use window.open() to pass along some arguments to another page. I want the page to be myPage.html?img=1.jpg Where once on that page I will use javascript to get the arg and show the image. However I cannot figure out how to do this with window.open() cause it says the pages does not exist which I can understand. window.open('myPage.html?img=1.jpg','_blank') Hope this makes sense and I don't even know if it is possible. 回答1: myPage.html should exist, and check the docs on window

Print function in Chrome no longer working

拜拜、爱过 提交于 2019-11-28 12:32:40
Our website has a feature whereby a member profile can be printed. The way that it works is that a javascript function is attached to a button via an onsubmit. The javascript function uses a window.open to reopen the page in a special mode, which redisplays a printer-friendly version of the page. This functionality has been in place since about 2008, and works in all browsers. Except about a week or so ago it has stopped working in Chrome. With Chrome, what happens is that the opened window does open, but then another blank window briefly opens, and then the all of them close. In searching for

how to prevent reopening new window using jQuery?

风格不统一 提交于 2019-11-28 12:28:48
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? You could do: var childWin; function winOpen(url) { //check if child window is already open if (childWin &! childWin.closed && childWin.focus){ childWin