0

I am making a tiny bot-like page that will redirect the user to a certain page plus a paramater.

Basically:

  1. A page inside an iframe redirects the user to a random page on my site (already done)
  2. The script appends ?action=purge to the page inside the iframe
  3. The script refreshes the page after 1 second (already done)

The part I need is the middle part, I have no idea how to do that. I know you can use the meta refresh to redirect, but how do you make it so the URL reads the iframe's URL plus ?action=purge"

secretformula
  • 6,414
  • 3
  • 33
  • 56
iggyvolz
  • 91
  • 1
  • 7

1 Answers1

0

Try this:

var src1 = document.getElementById('id_of_the_iframe').getAttribute('src');
var src2 = src1 + '?action=purge';
document.getElementById('id_of_the_iframe').setAttribute('src',src2);

If this doesn't work or is not what you are looking for then I don't know.

Edit:

Make sure you call the script after the page has loaded, since you can't change what hasn't been loaded into the DOM in a page yet.

kukac67
  • 298
  • 1
  • 3
  • 12