Sending parameter when opening an app from web [duplicate] - javascript

This question already has answers here:
Open iOS app from URL AND Pass Parameters
(2 answers)
Closed last month.
Is it possible to pass parameters when opening an app through web via deep link on ios and andriod?

You can pass parameters via URL parameters or in the path itself.
https://www.myapp.com/path/5/anotherpath/2
https://www.myapp.com/path/?parameter1=5&parameter2=2
Then you can parse in the receiving Activity. Use helper methods like getQueryParameter() and getPathSegments().

Related

Can get requests placed by <a> tags include data? [duplicate]

This question already has answers here:
Sending PHP GET data to server using Html links
(2 answers)
Closed 4 years ago.
I know that requests placed by jQuery $.get() can include an optional parameter for additional data. I was wondering if there was any way to pass that information through requests that come about by clicking an link, or relocation the windows location.
Yes, you can use a Query String.
Excerpt:
Typical URL containing a query string is as follows:
http://example.com/over/there?name=ferret
When a server receives a request for such a page, it may run a program, passing the query string, which in this case is, name=ferret unchanged, to the program. The question mark is used as a separator, and is not part of the query string.
So your anchor could be:
My Link
or
My Link
or
My Link
Be aware that you can get caching issues by links/get requests.
The only way to pass data through a link as the page is visited is to use URL Parameters/Query Strings.

Why should I use POST etc methods instead of URL parameters? [duplicate]

This question already has answers here:
When do you use POST and when do you use GET?
(27 answers)
Closed 6 years ago.
We can accomplish the same thing by doing:
localhost:3000/endpoint?var1=val1&var2=val2
That we can do by using POST with a JSON body.
So why should anyone use PUT/POST/PATCH if they can get the same goals by using url params? Even with auth, instead of header, you can send the information of the auth token back and forth by using a parameter?
one reason is that GET parameters have to be URL-encoded.
then there are limitations of URL length documented in RFC I think.
This will make it difficult when transfering large data (e.g. file uploads,...)
additionally, developers may want to hide some informations from the user, to prevent users to bookmark a page with all these parameters...
Definitely NO reason for POST args is security on the transport layer. in both cases the data are plain text in HTTP, and both (also the URL) are encoded end-to-end when using a secure HTTPS connection.
It is more secure, because your data is encrypted and sent in the header of the request.

jQuery AJAX not sending hashtag symbols which causes my request to fail [duplicate]

This question already has answers here:
Passing "#" hash symbol in request parameter of url not working in Firefox
(3 answers)
Closed 6 years ago.
I have a problem. I'm working with Elixir Phoenix and React.JS. I have a Token that is used to verify the user. This Token also has hashtags in it so when I send a request to verify it, it is being sent without the hash symbols and what comes after them which makes my request to fail. How can I solve this issue? For some reason I don't have that problem when I use fetch with React Native, but here I do. I tried many variations as you can see in the image.
The hash and anything after it will not be sent by browsers in a request.
You should encode the token so that the hash is escaped.
fetch('http://localhost:4000/api/users/'+encodeURIComponent(accesstoken), {

Embed Facebook post with Angular [duplicate]

This question already has answers here:
facebook social plug-in not showing up when added dynamically
(2 answers)
Closed 7 years ago.
I am working around a Facebook sdk and angularJS.
I have a trouble about how to dynamic loading Facebook Embed post in Angular Template.
after request Ajax success it doesn't show anything
<div class="fb-post" data-href="{{EmbedPostUrl}}" data-width="500"></div>
Any idea ?
The Problem could be that the Expression in data-href will be resolved immediately to {{EmbedPostUrl}} which will trigger an 404 Error.
Try to write a custom directive which will create the data-href attribut if the passed value is not false.
If that doesnt works, try to load the facebook sdk asynchronous after the ajax call was done.
And if you need to change the url sometimes, try to create the whole element by yourself wit a custom directive.

How log express.js POST parameters [duplicate]

This question already has answers here:
How to process POST data in Node.js?
(30 answers)
Closed 8 years ago.
I'm wondering how to get an array that contains all parameters sent in a HTTP request.
If I read the doc: http://expressjs.com/4x/api.html#req.params
I can see that using req.params and req.query, params will be linked to the route parameters and query to the GET parameters. But how can I log the post parameters? The req.param() method requires an argument and doesn't returns an array if I don't provide one. Since all POST parameters must be used through req.param(), there is no way to log them for now. Or am I missing something?
My goal is to efficiently log all parameters to debug easily the application during development, let me know if you have a better way.
You're looking for req.body, which contains the parsed POST body. (assuming you have middleware that parses it)

Categories

Resources