I am trying to use the i frame buster buster code but i need to use a 204 url. How do i create page that gives of a 204 no content error so that this iframe bustter buster code works
<script type="text/javascript">?
var prevent_bust = 0;?
window.onbeforeunload = function() { prevent_bust++; }?
setInterval(function() {?
if (prevent_bust > 0) { ?
prevent_bust -= 2;?
window.top.location = '';?
} ?
}, 1);?
</script>
in the window.top.location =
i am suppose to a 204 url so how do i create one
I am trying to use the i frame buster buster code but i need to use a 204 url. How do i create page that gives of a 204 no content error so that this iframe bustter buster code works
<script type="text/javascript">?
var prevent_bust = 0;?
window.onbeforeunload = function() { prevent_bust++; }?
setInterval(function() {?
if (prevent_bust > 0) { ?
prevent_bust -= 2;?
window.top.location = 'http://domain.';?
} ?
}, 1);?
</script>
in the window.top.location =
i am suppose to a 204 url so how do i create one
- 3 this thing is made by the server (Backend), just imagine the security gap if a simple user could do that – Yehia Awad Commented Jul 17, 2016 at 1:24
- @YehiaAwad - Who are you calling "simple"? In any case, the answer would be "do it server-side with steps A, B, and C". – nnnnnn Commented Jul 17, 2016 at 1:29
- @nnnnnn simple user I mean a site visitor. don't understand me wrong ) – Yehia Awad Commented Jul 17, 2016 at 1:31
2 Answers
Reset to default 5Use this service http://httpstat.us/. Just add the status code you want at the end. i.e. http://httpstat.us/204
Http Response Status codes are returned by the server of the page you are sending a HTTP request to. This information is transferred via HTTP (Hyper Text Transfer Protocol) and is NOT something you can control from the client side javascript.
So for you, you would need to create a page on your site that returns this status code in it's http headers and redirect to it from your javascript.
Since you don't specify what server technology you are using, here are some links on how to set the response codes in a few different languages:
- PHP
- .NET
- Node Express