javascript - Bookmarklet to open a new window forwards current window to [Object Window]? -


I am using a small booklet that opens a webpage in a new window. It works correctly on Chrome

However, when I use the same in Firefox, it opens a new window, which contains a new web page, but the page on which this bookmarklet was clicked That text was sent to some page with the [object window] . How do I solve this issue?

My code:

  & lt; A href = "javascript: open ('http://www.google.com', 'targetname', 'height = 500, width = 500');" & gt; Bookmarklet & lt; / A & gt;   

Please tell me how to solve this problem.

Thank you

You will have to "eat" the last return value in the Javascript URL, returnofValue! = 'Undefined' returning anything document.write returnValue) . And returns the window.open newly created window , so output of "[object window]". Of course, you can do this without adding zero (0) statement at any time, but it is very clumsy, no-messaging version (return value is eaten, call phones left without adsorption ):

  Javascript: zero (open ('http: //www.google.com', 'latja name', 'hight 500, width = 500'))  < / Pre> 

You can expand your bookmarklet so that you can better address the annoyance at the global level. ( return statement):

  javascript: (function () {open ('http: //www.google.com', 'targetname', ' Height = 500, width = 500 '); / * Go to more code * /}) ()    

Comments