jamey8420 Posted April 29, 2013 Share Posted April 29, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/277416-windowopen-not-working-within-an-iframe/ Share on other sites More sharing options...
Irate Posted April 29, 2013 Share Posted April 29, 2013 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> Quote Link to comment https://forums.phpfreaks.com/topic/277416-windowopen-not-working-within-an-iframe/#findComment-1427126 Share on other sites More sharing options...
jamey8420 Posted April 29, 2013 Author Share Posted April 29, 2013 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? Quote Link to comment https://forums.phpfreaks.com/topic/277416-windowopen-not-working-within-an-iframe/#findComment-1427150 Share on other sites More sharing options...
Irate Posted April 29, 2013 Share Posted April 29, 2013 https://developer.mozilla.org/en-US/docs/HTML/Element/iframe It seems to be able to work in all implementations of HTML5. So, try setting the sandbox attribute to allow-scripts and then testing it within a HTML5 supported browser. Quote Link to comment https://forums.phpfreaks.com/topic/277416-windowopen-not-working-within-an-iframe/#findComment-1427155 Share on other sites More sharing options...
jamey8420 Posted April 30, 2013 Author Share Posted April 30, 2013 Even without the sandbox attributes set, the link works in Google Chrome. Unless anyone else has any ideas that may end up being my work around until we get IE10 installed here. Quote Link to comment https://forums.phpfreaks.com/topic/277416-windowopen-not-working-within-an-iframe/#findComment-1427318 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.