- Download the latest jQuery Remap from GitHub at Here.
- Download jQuery Remap from xodustech by clicking Here.
Simply include the jsRedirect.js file into your site's head section. The script should be placed as close to the top as possible so that it runs before any other scripts or content are loaded for the site.
One may wish to programatically engage the redirection check instead of having it run automatically. This can be accomplished by commenting out or removing the last line in jsRedirect.js.
Then add the call to your own function or code.
The options below are configured directly in jsRedirect.js.
Number in percents of 100 amount of users to redirect.
Name of the cookie to store the redirected or excluded state.
Destination URL to where the script should redirect the user.
Whether or not to append the requested path of the old URL to the new URL.
Check for flag in incoming URL to force redirection to the new URL and set the cookie.
Check for flag in incoming URL to force exclusion of redirect and set the cookie.
Days until the redirect cookie will expire.
Days until the exclusion cookie will expire.
Testing can be performed by commenting out the jsRedirect checkCookie() method and adding the unitTest() method to your body tags onload attribute. The test.html file included in this repository provides an example of this.
Once redirected you may find it difficult to return back to the original URL in which case you can add the value defined in the paramForceExclude to your URL to override the redirection. http://yourdomain.tld/?xoForceExclude for example. Likewise you can use the value defined for paramForceRedirect to test the redirection without having to hit the haystack or clear your cookies each reload.