React-router link gets escaped on share - react-router

I'm using react-router to handle my routing.
Let's say I want to share a page with a search param :
http://myshop.localhost:3001/?collection=D%27apr%E8s%20Orelsan
If I copy/paste this link in my browser, it'll work just fine. Now, if I share it, or copy/paste in anywhere else (a messenger link, a facebook post, whatever), whoever clicks on it will be redirected to
http://arcadyrecords.localhost:3001/?collection=D%2527apr%25E8s%2520Orelsan
Therefore messing up my fetching logic.
How can I prevent external links from re-escaping an url that is already escaped ?

Related

Using Instagram API for simple web page

So I am working on a fairly simple project, basically a web page that should list the captions from a certain instagram account. It's all designed, it just needs to be lit up with the content. Have a look at http://evanshellborn.com/speechofthebeets/.
I found that you can see a json file containing all the necessary data at instagram.com/{username}/media. So in my case, https://www.instagram.com/beets_are_life/media/. So before I put that page actually online, I was on my local machine, and I did a JSON call to that page and it worked perfectly. So I built it all out and my web page loaded the captions just like I wanted it to.
Then I went to put it online, (http://evanshellborn.com/speechofthebeets), but it doesn't work. Have a look at the script at the bottom of it, on my localhost that code works and the captions get loaded. But on the live page, I get an access not allowed error in the console. So I think Instagram doesn't allow this sort of direct access anymore, you have to go through their API.
Now I've tried looking at the API but it seems rather confusing. Basically what I'm asking for is a different JSON url that would give me the same result as https://www.instagram.com/beets_are_life/media/, but that would work from the live page.
I think https://api.instagram.com/v1/users/{user-id}/?access_token=ACCESS-TOKEN would work, just replacing {user-id} with the appropraite user_id. But where do I get an access token?
From reading https://www.instagram.com/developer/authentication/, it looks like you get one when a user puts in their user credentials. But I don't want to have anyone log in, I just want a simple web page.
Hopefully that made sense. How can I do what I want?
Looks like the API url https://www.instagram.com/beets_are_life/media/ does not support jsonp (no callback support), so u cannot use javascript (client side) for making API request, it will fail because of Access-Control-Allow-Origin error on browser side, you have make this API call on server side as proxy.
I guess https://www.instagram.com/<USER_NAME>/media/ is not a publicly documented API, thats the reason it is not supporting jsonp, Instagram uses it for their website and since it is same-origin it will work for them on client-side
This link will help you embeding the instagram on a simple html webpage.
There is a button on the bottom of the post on instagram.when you click on the link a menu pops up. then click on embed
now a box pops up
just copy paste the html and you are done.
it will fetch the post for you

Foswiki registration redirect - no page loaded

I have a foswiki site with user registration. It uses the standard registration form wherein users click a "register" button after filling the form. It redirects to: http://localhost/foswiki/bin/register/Main/WebHome and sits (no page loads and no error is shown). The source code shows this is correct, that is the button should post to this URL. I'm not sure why it isn't redirecting to the homepage. The user entry is created correctly and I can manually change the URL to: http://localhost/foswiki/bin/view/Main/WebHome and have it work.
I cannot find why it redirects to /bin/register... rather than /bin/view.... I thought it should be in the http config file, but I couldn't find it.
I compared the results in the console with those from registering on the foswiki website, but cannot see a difference.
I was able to get an answer on the IRC. It is an issue with the quickmenu skin. I stopped using the skin and the issue was corrected.

href: Can I get Google search results to use/display the final redirect url?

My site has webpage urls that use the following format:
www.mysite.com/id/pretty_title
The front page links to these pages, but the href actually contains some parameters:
www.mysite.com/id/?some_ugly_parameters_to_let_me_know_what_search_it_is_from
This then redirects to
www.mysite.com/id/pretty_title
which shows the page.
My issue is that Google's search results show the link to the page as the ugly one instead of the pretty redirected one. Besides looking ugly, it can cause errors because the parameters that are included in the ugly link are irrelevant to a user who directly enters a page from Google.
Can I get Google to only use the final redirect url? Or otherwise avoid this issue? I do need to pass these parameters along. Storing info in the session won't work because a user can have several tabs open.
On the "ugly URL page" you put <link rel="canonical" href="www.mysite.com/id/pretty_title"> which tells the search engine your preferred URL for that content.
Can also set www.mysite.com/id/?some_ugly_parameters_to_let_me_know_what_search_it_is_from to have a 301 redirect to your pretty URL
Canonical URLs: https://support.google.com/webmasters/answer/139066
301 Redirects: https://support.google.com/webmasters/answer/93633?hl=en

How to get around myspace's msplinks

Im editing the html of a myspace page to insert a form. For the 'action' attribute of the form I have a web address (naturally). It works fine on a real website, but what happens with myspace is that any links you enter are routed through the server (I believe) are replaced with an msplinks link instead. This royally effs up my form and I'm not sure how to get around it.
Any ideas?
EDIT: I know this is in flash but here http://www.myspace.com/brokensocialscene if you click on free download you get a box where you can enter your email.
Maybe it's a little late. But here is what I did:
Go to tinyurl.com or another website which shortens urls.
Shorten the url and
use the new short url in stead of the original (long url) for myspace and you'll see, it works!
Well actually it is not a workaround for msplinks, but the result is the same, since you can now direct to any url.
Actually what you're doing is the same thing myspace did. Making the url redirect. You can use this for any kind of url you like. Skype Urls, itunes urls etc..
I used it for the url to launch iTunes and subscribe to my podcast. As you can see in the link below, it even allows url's other then http://
original url: itpc://dl.dropbox.com/u/14194526/itunes_podcast_feed.rng
the short url I used is: http://tinyurl.com/2uh3m23
Hope you can still use it.

When redirecting users from a legacy website to the new one, what is the best way to detect whether or not to show them a custom welcome message?

Say you have a legacy website running on an old code-base that offers certain functionality. The successor website is up and running, providing all the old functionality and more. For some time, there has been an HTML link on the old site pointing to the new one, for those users that care to click over.
Now, the legacy site is reaching its end of life, and you want to automatically redirect users to the new site, for example via a 301 or 302 redirect. However, when a user encounters this redirect, you want to also display a friendly message on the new site welcoming them and explaining why they are not seeing the old version.
When the user clicks an HTML link, the HTTP_REFERER header is populated, and the welcome message can be triggered via that value. However it appears that the same is not true when using 3XX redirect codes.
The top Google hit for this issue has this to say:
"HTTP 1.1 specification states it clearly: if a 3XX code is given, no
Referer value is passed. (eventualy, the URL that pointed to 3XX site)."
(http://www.usenet-forums.com/apache-web-server/37811-how-set-referer-redirect.html#post145986)
However I could not find this statement in a quick read through the spec (https://www.rfc-editor.org/rfc/rfc2616).
Can anyone suggest the proper way to achieve this functionality?
Note: This is not meant to be an all-encompassing solution. We understand that some clients don't even send the HTTP_REFERER header for privacy reasons, but for the sake of argument, let's ignore that use case.
First, This should be a 301, not a 302 redirect. Your redirection is permanent, so you want to indicate that. As to how to indicate the redirect, just add a parm to the url. Instead of redirecting to http://www.newsite.com redirect them to http://www.newsite.com?FromOldSite=Y
Could you just redirect them to a specific launch page? Like if try try to visit http://oldsite.com/desired/page, just send them to http://newsite.com/welcome?nextpage=/desired/page. The welcome page could show the message and then pass them over to the content. Alternatively, you could send them right to the new page with a ?show_welcome=true in the URL.
Not sure how you plan to redirect your users, but if you don't want to "ugly" up your URL, you might just set your own custom header when hitting the old site and then check for it at the new.