Skip to content

Instantly share code, notes, and snippets.

@parkerproject
Forked from pcg79/gist:738207
Created April 13, 2014 21:05
Show Gist options
  • Save parkerproject/10602300 to your computer and use it in GitHub Desktop.
Save parkerproject/10602300 to your computer and use it in GitHub Desktop.
Manipulate Interstitial
<script type="text/javascript">
$(document).ready(function() {
var href = $("#redirect_url")[0].href;
$("a#replace_me").attr("href", href);
$("a#replace_me").text(href);
$("#redirect_to").hide();
});
</script>
<p>Greetings. We are now redirecting you to the site that you requested.</p>
<p><a id="replace_me"></a></p>
<p>Have a great day!</p>
----
A quick jQuery tutorial:
$(document).ready
runs when all the elements on the page have loaded.
var href = $("#redirect_url")[0].href;
gets the first element whose ID is "redirect_url" and gets the "href" attribute. Since it's an <a> tag the href attribute is the URL.
$("a#replace_me").attr("href", href);
sets the "href" attribute of the <a id="replace_me"> tag to the variable href.
$("a#replace_me").text(href);
sets the text of the <a id="replace_me"> tag to the variable href. The text is what's inside the <a> tags. <a>This is the text</a>
$("#redirect_to").hide();
hides the <p id="redirect_to"> tag
As a note, if you use the Firefox browser you can use the Firebug plugin (http://getfirebug.com/) to easily view the elements of the interstitial page and execute JavaScript on the page directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment