I am using window.open to launch a link from within an iFrame. Here is my code to launch the link:

=iif(Fields!budgetid.Value>1,"javascript:void(window.open('"+"http://test/forms/Su....aspx?BudgetId=" & Fields!budgetid.Value & "'))","")

The link is showing up in my iFrame, but when I click the link nothing happens. If I right click, copy the shortcut, and paste into another browser tab the link does work.

The link is actually on a SSRS report rendered within that iFrame. When I run the report outside of the iFrame, the link works fine. Is there something Javascript related that I can do to make the link work from within the iFrame?

Thanks,
jamey8420

try using parent.window.open

Thanks Hop; still didn't work.

whats the "+" symbol for? concatenation is being done with an ampersand everywhere else in your code.

Should it not be:
"javascript:void(window.open('http://test/forms/Su....aspx?BudgetId=" & Fields!budgetid.Value & "')"

I think the IFRAME is technically "outside" the control of the window (for security reasons).

You can try removing the http: and instead do:

window.open("//test/forms/.....");

this way, you are not "leaving" the server to come back to the server, thus creating a security hole. If the double whack doesn't work, try just making a relative path from the IFrame src.

Alternatively, you can try to make the iframe src a relative path instead of http(s) so it is not "leaving" the server. Personally, I think this is probably your issue more than the former...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.