Remove ugly #_=_ string from URL when using Facebook OmniAuth
I was recently working on a Ruby on Rails project with the OmniAuth gem to provide Facebook Authentication.
When redirected from Facebook back to my application the URL contained this ugly/pesky little string:
e.g. www.mysite.com/logged-in#_=_
This piece of javascript will find this string and rewrite with with nothing ‘ ‘ on document .ready
$(document).ready(function () {
if (window.location.href.indexOf('#_=_') > 0) {
window.location = window.location.href.replace(/#.*/, '');
}});
This can be easily placed within your app/assets/application.js to globally rewrite this.
Written by John jensen
Related protips
1 Response
Thanks for sharing, I'll implement this ASAP - I agree it does look ugly.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Filed Under
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#