2

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.com';?
    }  ?
}, 1);?
</script>

in the window.top.location = i am suppose to a 204 url so how do i create one

Yehia Awad
  • 2,898
  • 1
  • 20
  • 31
llrenolds
  • 21
  • 5

2 Answers2

4

Use this service http://httpstat.us/. Just add the status code you want at the end. i.e. http://httpstat.us/204

Ross Lote
  • 814
  • 1
  • 8
  • 19
3

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:

Community
  • 1
  • 1
jennas
  • 2,444
  • 2
  • 25
  • 31
  • umm i am using wordpress soo i used the php way and nothing seemed to happen – llrenolds Jul 17 '16 at 05:07
  • @llrenolds I am not a PHP or Wordpress developer sorry so may require a new question. I did quickly search google though and found this.. maybe give this a try https://codex.wordpress.org/Function_Reference/status_header – jennas Jul 18 '16 at 05:58