Skip to content

Instantly share code, notes, and snippets.

@paulmorriss paulmorriss/gist:10983264
Last active Aug 29, 2015

Embed
What would you like to do?
NetCommunity - redirect to previous page after login - see http://manypies.paulmorriss.com/2011/11/blackbaud-netcommunity-redirect-to.html
<!-- Javascript for parseQueryString -->
<script type="text/javascript" src="/NetCommunity/Document.Doc?id=10"></script>
<script type="text/javascript">
function gotoPreviousPageId()
{
loginPageId='274';
loginHomePageId='275';
// Technically this is not the query string for this page, it is the query string for the referring page
if (document.referrer !== '') {
var queryData = parseQueryString(document.referrer);
// As the previous page URL was something like ...pid=loginpage&amp;srcid=donationpage we want to extract the srcid, which is the id of the page before the previous page, probably a donation page
// We do not redirect if the previous page was the login page
if (queryData.srcid){
if (queryData.srcid !== '') {
if (queryData.srcid != loginPageId) {
if (queryData.srcid !='1') { //1 was login link from top nav on any page on main site - now removed, but code kept in case useful
window.location = "https://secure.yoursite.com/NetCommunity/SSLPage.aspx?pid="+queryData.srcid;
}
else {
// Redirect to logged in home page
window.location = "https://secure.yoursite.com/NetCommunity/SSLPage.aspx?pid="+loginHomePageId;
}
}
else {
// Redirect to logged in home page
window.location = "https://secure.yoursite.com/NetCommunity/SSLPage.aspx?pid="+loginHomePageId;
}
}
else {
// Redirect to logged in home page
window.location = "https://secure.yoursite.com/NetCommunity/SSLPage.aspx?pid="+loginHomePageId;
}
}
else {
// Redirect to logged in home page
window.location = "https://secure.yoursite.com/NetCommunity/SSLPage.aspx?pid="+loginHomePageId;
}
}
else {
// Redirect to logged in home page
window.location = "https://secure.yoursite.com/NetCommunity/SSLPage.aspx?pid="+loginHomePageId;
}
}
function runit3(){
window.onload = gotoPreviousPageId;
}
runit3();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.