Created
October 4, 2010 22:13
-
-
Save BenWard/610557 to your computer and use it in GitHub Desktop.
From the files of ‘stupid one line scripts that the world should not need’, this takes a URL from a JavaScript-based app like Twitter or Hype Machine and presents you with an easily copyable, real URL that doesn't contain any ‘#’ nonsense.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function()%20{var%20io%20=%20prompt(%22Dehashed%20URL%20(share%20this.):\n\nCopy%20the%20URL,%20then%20press%20OK%20to%20reload%20and%20confirm%20that%20it%20works,%20or%20cancel%20to%20stay%20on%20this%20page.%22,window.location.href.replace(/\/?#!?\/?/,%20%27/%27));if(null%20!==%20io)%20{window.location.href%20=%20io;}})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
// De-Hash. Removes # and #! from URLs, and presents them to you to copy | |
// to share with your friends, or reuse in another app like Google | |
// Translate. | |
// | |
// Sharing # or #! links means that the person you give them too needs to | |
// have JavaScript available in their browser to view the page. Most of | |
// them will. Unless they've turned it off for some reason (maybe they're | |
// paying for data by the megabyte when they see your link) or their | |
// network is unreliable (maybe they're abroad outside of the first-world, | |
// maybe they're on AT&T.) | |
// | |
// This doesn't guarantee that the page you share will work without | |
// JavaScript, of course. But the best web apps will at least load the | |
// page content for crawling and static display. | |
// | |
// If you think this readme is a little sanctimonious for a one-line find- | |
// and replace script, you're right. Now please stop breaking my internet. | |
// | |
// Works with example.com/#!/blah and example.com/#blah/sd format URLs, | |
// might not work with example.com/index.php#/events.php?blah form URLs | |
// (but Facebook seems to have stopped doing that, anyway.) | |
var io = prompt( | |
"Dehashed URL (share this.):\n\nCopy the URL, then press OK to reload and confirm that it works, or cancel to stay on this page.", | |
window.location.href.replace(/\/?#!?\/?/, '/') | |
); | |
if(null !== io) { | |
window.location.href = io; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment