Jump to content

window.open not working within an iFrame


jamey8420

Recommended Posts

I have a SSRS report that has a hyperlink to another website.  The link to the site works fine when I access the report directly.  However, I am displaying the report in an iFrame.  When I click on the link within the iFrame, nothing is happening.  I can copy my link, paste it into another window and I am able to see the link work.

 

Here is my link:

 

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

 

 

 

code for my iFrame:

<iframe name='myIframe' id='myIframe' src='http://reports/ReportServer?%2fAct%2fReports%2fAlternative+Report&rs:Command=Render&rc:Stylesheet=my_htmlviewer' height='650' width='100%' scrolling='auto' frameborder='0' ></iframe>

 

 

I've gone over the javascript syntax and I know that this is working for me.  It just feel that maybe the iFrame is somehow "blocking" the link from working?  Maybe another attribute that would allow such links to work?  Thoughts?  Thanks for the help.

 

 

jamey8420

Link to comment
Share on other sites

You need to set the allowScriptAccess attribute within the iframe tag to "always", otherwise, due to the same origin policy, no scripts will be executed as the default is "sameOrigin".

 

Like this:

 

<iframe allowScriptAccess='always' name='myIframe' id='myIframe' src='http://reports/Repor...t=my_htmlviewer' height='650' width='100%' scrolling='auto' frameborder='0' ></iframe>
Link to comment
Share on other sites

Irate,

Thanks for the thought.  I added the respective code as you outlined and it didn't make a difference.  The link still didn't work.  But I did investigate allowing script access and found the iFrame sandbox attribute, which seems to handle this.  However, it looks like it's only supported on IE10 and higher.  Of course, we are below that.  Any other thoughts on how to get around this restriction?  

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.