-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
i have a variable in my java-source
String aLink = "http://xyz.de/news/-/news/" + row.getAttribute("row");
and will open a new site in java with this variable
Clients.evalJavaScript("window.open(aLink,'')");
but it is shown a javascript-error. What is wrong?
Regards
aLink
is a Java variable here. However when you send "window.open(aLink,'')"
via Clients.callJavaScript()
it is sent as a string as it is and evaluated at the client-side. Now at client-side while evaluating "window.open(aLink,'')"
there is no aLink var hence the JS error. You should concatnate aLink
value before providing it to Clients.callJavaScript()
like
String str = "window.open('" + alink + "','');"
Clients.callJavaScript(str);
Asked: 2013-11-14 13:35:02 +0800
Seen: 33 times
Last updated: Nov 15 '13