Skip to content

Instantly share code, notes, and snippets.

@bibstha
Created July 22, 2014 15:05
Show Gist options
  • Save bibstha/7ce2678d5b1d2a014b99 to your computer and use it in GitHub Desktop.
Save bibstha/7ce2678d5b1d2a014b99 to your computer and use it in GitHub Desktop.
<a href="javascript:var l = document.location; new_href = l.origin + '.eaccess.ub.tum.de' + l.pathname + l.search; window.location.href = new_href">Access with TUM</a>
@bibstha
Copy link
Author

bibstha commented Jul 22, 2014

More readable version. Need to check if url already contains eaccess.ub.tum.de

<a href="javascript:(function(){
  var l = document.location; 
  new_href = l.origin + '.eaccess.ub.tum.de' + l.pathname + l.search; 
  window.location.href = new_href
})()">Access with TUM</a>

@bibstha
Copy link
Author

bibstha commented Jul 22, 2014

Contains check for eaccess in url

<a href="javascript:(function(){
  var l = document.location; 
  if (l.origin.indexOf('eaccess') == -1) {
    new_href = l.origin + '.eaccess.ub.tum.de' + l.pathname + l.search; 
    window.location.href = new_href
  }
})();">Access with TUM</a>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment