• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSException.

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
When I try to open a new window using window.open, I get JSException. I am passing the url to be opened from a java program to the javascript as given below:
Here is the code in the java program :
public void openNewWindow()
{String strURL[] = new String[1];
strURL[0]="http://www.abc.com";
try
{
JSObject win = JSObject.getWindow(this);
win.call("openWindow",strURL);
}
catch (Exception ex)
{System.out.println("ex::::"+ex);
}
}
And here is the JavaScript code :
function openWindow(strURL)
{
window.open("strURL","","toolbar,location,menubar,titlebar");
}
Can anyone tell me why I get this error ?
Thanks in advance,
arul.
 
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Haven't used Java to call a javascript to open a window before, but one thought is that you have quotes around your strURL in your javascript code. Since this is a variable, I would think you would not want to have the quotes. So it would read:
window.open (strURL,"name","toolbars,menubar,scrollbars");
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic