Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #27421 > unrolled thread
| Started by | Amandeep <maman@google.com> |
|---|---|
| First post | 2015-04-28 13:04 -0700 |
| Last post | 2015-04-30 01:55 +0200 |
| Articles | 6 — 6 participants |
Back to article view | Back to comp.lang.javascript
Prevent refresh when url returns from another app. Amandeep <maman@google.com> - 2015-04-28 13:04 -0700
Re: Prevent refresh when url returns from another app. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-04-29 00:02 +0200
Re: Prevent refresh when url returns from another app. Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-04-29 15:49 -0300
Re: Prevent refresh when url returns from another app. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-04-30 08:25 +0200
Re: Prevent refresh when url returns from another app. Denis McMahon <denismfmcmahon@gmail.com> - 2015-04-29 23:26 +0000
Re: Prevent refresh when url returns from another app. "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-04-30 01:55 +0200
| From | Amandeep <maman@google.com> |
|---|---|
| Date | 2015-04-28 13:04 -0700 |
| Subject | Prevent refresh when url returns from another app. |
| Message-ID | <6f5a2e3a-36ce-4887-809c-dd9f829a054a@googlegroups.com> |
Hi All, So here is my situation. I trigger a bar-code scanner app from my webpage, and once the app is open, I am able to scan a bar-code and retrieve it via URL. NOW, I have multiple input fields on a page that the url lands on. I take the scanned bar-code from the url and put it inside the input fields. The problem is that when the URL returns with the scanned bar-code, it refreshes the whole page therefore erasing all the previously entered values from input fields. So, is there a way where I can retrieve the bar-code from the url without refreshing the page.(So that the input fields retain their values). OR how can I retain the values entered in the input fields. I do not want to go to the server side of the equation. Please provide solutions workable only from the front-end side. Below is the Fiddle I created. see if that is any help. http://jsfiddle.net/villageboy/cxr6srvo/ Thanks in advance.
[toc] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2015-04-29 00:02 +0200 |
| Message-ID | <XnsA48B5D2EADeejj99@194.109.133.246> |
| In reply to | #27421 |
Amandeep <maman@google.com> wrote on 28 apr 2015 in comp.lang.javascript: > So, is there a way where I can retrieve the bar-code from the url > without refreshing the page.(So that the input fields retain their > values). OR how can I retain the values entered in the input fields. var xhr = new XMLHttpRequest(); ...etc. forms[0].elements['myInput'].value = result; > I do not want to go to the server side of the equation. Please provide > solutions workable only from the front-end side. I don't understand this gibberish, but, as this is not a help desk, please do not direct us how we should respond. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Joao Rodrigues <groups_jr-1@yahoo.com.br> |
|---|---|
| Date | 2015-04-29 15:49 -0300 |
| Message-ID | <mhr94f$k9g$1@speranza.aioe.org> |
| In reply to | #27422 |
On 28/04/2015 19:02, Evertjan. wrote: > Amandeep <maman@google.com> wrote on 28 apr 2015 in comp.lang.javascript: > >> So, is there a way where I can retrieve the bar-code from the url >> without refreshing the page.(So that the input fields retain their >> values). OR how can I retain the values entered in the input fields. > > var xhr = new XMLHttpRequest(); > ...etc. > forms[0].elements['myInput'].value = result; > Or the HTML5 Fetch API, supported in recent versions of Firefox and Chrome. -- Joao Rodrigues
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2015-04-30 08:25 +0200 |
| Message-ID | <3353818.0hvg7bqIvD@PointedEars.de> |
| In reply to | #27423 |
Joao Rodrigues wrote: > On 28/04/2015 19:02, Evertjan. wrote: >> Amandeep <maman@google.com> wrote on 28 apr 2015 in comp.lang.javascript: >>> So, is there a way where I can retrieve the bar-code from the url >>> without refreshing the page.(So that the input fields retain their >>> values). OR how can I retain the values entered in the input fields. >> var xhr = new XMLHttpRequest(); >> ...etc. >> forms[0].elements['myInput'].value = result; > > Or the HTML5 Fetch API, supported in recent versions of Firefox and > Chrome. And Opera. But: <https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API> | This is an experimental technology | Because this technology's specification has not stabilized, check the | compatibility table for […] use in various browsers. | Also note that the syntax and behavior of an experimental technology is | subject to change in future versions of browsers as the spec changes. In this case, “recent” means only the most recent stable versions have support for it enabled by default, namely Chrome 42, Firefox 39, and Opera 29. I recommend to not use it for Web sites on the Internet at least at this point. -- PointedEars FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix> Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2015-04-29 23:26 +0000 |
| Message-ID | <mhrpa8$rob$1@dont-email.me> |
| In reply to | #27421 |
On Tue, 28 Apr 2015 13:04:02 -0700, Amandeep wrote: > So, is there a way where I can retrieve the bar-code from the url > without refreshing the page.(So that the input fields retain their > values). OR how can I retain the values entered in the input fields. Use a "background" http request to get the bar code from the url. google for xmlhttprequest -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | "Christoph M. Becker" <cmbecker69@arcor.de> |
|---|---|
| Date | 2015-04-30 01:55 +0200 |
| Message-ID | <mhrr0i$sv2$1@solani.org> |
| In reply to | #27424 |
Denis McMahon wrote: > On Tue, 28 Apr 2015 13:04:02 -0700, Amandeep wrote: > >> So, is there a way where I can retrieve the bar-code from the url >> without refreshing the page.(So that the input fields retain their >> values). OR how can I retain the values entered in the input fields. > > Use a "background" http request to get the bar code from the url. [...] To get anything from "the url", just use window.location and appropriate string manipulation functions (regex might come in handy). Disclaimer: I'm well aware that this doesn't answer the *intended* question. -- Christoph M. Becker
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web