My code right now is currently this.
As you can see, it generates 2 random strings into places into a link containing both letters and numbers. But how can I force it to open or redirect to that newly generated link? Or even perhaps iFrame it?
Since right now, it just simply writes it out how the link will look after being generated.
By the way, what I am looking for is also here: " How to change part of an iFrame’s URL to a random string? "
I got this far after seeing that.
function randString(x) {
var s = "";
while (s.length < x && x > 0) {
var r = Math.random();
s += (r < 0.1 ? Math.floor(r * 100) : String.fromCharCode(Math.floor(r * 26) + (r > 0.5 ? 97 : 65)));
}
return s;
}
document.getElementById("doo").innerHTML = randString(4);
The above is my JavaScript code found on the JSFiddle which I'm using for generating a part of the link.