-1

I have migrated my application from wicket 1.x to wicket 8.x and now facing an error to display PDF on iframe. It is showing as blank on the iframe.

I am trying to display PDF in the iframe tag in the HTML on page load but it is showing as blank.

Share the detailed code below path: https://github.com/smartuadk/Shared_Repo_StackOverflow/tree/main/PDF_Preview

user3552342
  • 657
  • 1
  • 5
  • 14
  • Are there any errors in the server logs or JavaScript errors in the browser ? Show us your code. – martin-g Feb 10 '21 at 08:51
  • Where is the iframe ? – martin-g Feb 11 '21 at 08:59
  • Iframe is loading on this Id "resourcePanel" in TestPDFPreview.html page. Its defined under this method onComponentTag() in TestResourcePanel.java. Kindly check I have committed 2 new files. – user3552342 Feb 11 '21 at 09:19
  • Not sure why simple iframe tag also not displaying PDF in the wicket html page. But able to see PDF in iframe in the normal html page. – user3552342 Feb 12 '21 at 09:35
  • Hi @martin-g, please find the GitHub repository path for the code details - https://github.com/smartuadk/Shared_Repo_StackOverflow/tree/main/PDF_Preview – user3552342 Feb 15 '21 at 09:16

1 Answers1

1

Please add below http security header tag in Spring security module xml file to allow Spring security to display the HTML iframe in spring application:

<security:http use-expressions="false">
    <security:headers>
        <security:frame-options disabled="true"></security:frame-options>
    </security:headers>
</security:http>

This solution worked for me and now my application is able to display the iFrame without any error and able to load PDF file in iFrame as well.

user3552342
  • 657
  • 1
  • 5
  • 14