File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Cross frame Scripting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Cross frame Scripting" Watch "Cross frame Scripting" New topic

Cross frame Scripting

lakshmi gullapudi

Joined: Mar 18, 2013
Posts: 16
How to add X-frame options header in .htm file

its working fine when i add <% response.addHeader("X-Frame-Options", "SAMEORIGIN"); %> in JSP page.

But not sure how to add X-frame options in .htm file?

Can any one please help me?

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33119

You can turn it into a JSP . You can also have your web server (for example Apache) set the headers - I've never needed to do that though.

You can't add this header directly to a HTML file.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Rob Crowther
Ranch Hand

Joined: Nov 06, 2012
Posts: 297

You would have to configure your web server to send the header, either with all requests or just for requests matching a particular pattern. MDN has some instructions for Apache and nginx.

Read my books: Hello! HTML5 & CSS3 | HTML5 in Action | Read my blog
I agree. Here's the link:
subject: Cross frame Scripting
It's not a secret anymore!