2

I would greatly appreciate any help with a script that I intend to run by clicking a bookmark that will remove the end part of a flickr url.

I presently have the following code

javascript:(function(){location.href=location.href.replace('/in/photostream', '/')})();

I based what I have with the code I found on the following page:Simple Javascript bookmarklet question

So lets say I start on the following url https://www.flickr.com/photos/nasacommons/7651153916/in/set-72157630766688018

I want to end at https://www.flickr.com/photos/nasacommons/7651153916/

Now since flickr uses many different location references after the image url other than just '/in/photostream' I am looking to have the code replace '/in/' and everything that follows it with just '/'

Thanks a bunch!

1 Answer 1

3

Try This :-

location.href = location.href.substring(0,location.href.indexOf("in"));

OR

location.href = location.href.substring(0,location.href.lastIndexOf("in"));
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.