java - Allow loading of my own website into iframe -
there way disable security validation:
load denied x-frame-options: http://localhost:8080/mywebsite/page/1 not permit framing.
this occuring because trying add own url iframe on app.
i tried in page responds in url above:
<% response.addheader("x-frame-options", "allow-from: localhost"); %> <% response.addheader("x-frame-options", "allow"); %> <% response.addheader("x-frame-options", "same-origin"); %>
none of them worked!
the follow code solved question:
@requestmapping(value="/page/{id}", method=requestmethod.get) public @responsebody modelandview load(@pathvariable string id, httpservletresponse response) { response.setheader("x-frame-options", "sameorigin"); map<string,object> parameters = new hashmap<string,object>(); ... return new modelandview("page", parameters);
}
Comments
Post a Comment