1

Problem with Clients.evalJavaScript [closed]

asked 2013-11-14 13:35:02 +0800

andij62 gravatar image andij62
315 1 7

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

delete flag offensive retag edit

The question has been closed for the following reason "the question is answered, right answer was accepted" by ashishd
close date 2013-12-31 04:27:55

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-11-15 02:21:37 +0800

ashishd gravatar image ashishd flag of Taiwan
1972 6

updated 2013-11-15 02:22:07 +0800

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);
link publish delete flag offensive edit

Comments

1

logical, thanks for your help!

andij62 ( 2013-11-15 10:27:53 +0800 )edit

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-11-14 13:35:02 +0800

Seen: 33 times

Last updated: Nov 15 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More