Hard refresh the page every time when I update the code - javascript

Whenever I update the code on production the changes can't reflect without hard refreshing (ctrl+F5) the page. So, Is there any way by coding I can handle this problem because the end user doesn't know these things.
Pls suggest. Currently, I am developing using the Dot net core for API's and reactJS as frontend.

You can implement PWA, whenever a new version/file is available it automatically downloads. In PWA you can add an alert like "App Update is available" Here is the reference for ReactJs: https://dev.to/daniellycosta/showing-new-version-available-notification-on-create-react-app-pwas-3jc9

Related

How to auto detect changes on a page and refresh content with AJAX?

I've got a simple help desk type system using WordPress posts. If you refresh the page, it queries the database and displays any new replies.
At the moment I am refreshing the page every couple of minutes to grab fresh replies, but this isn't the best option because if someone is writing a reply, it could be lost when the page reloads.
I'd like the page to be able to auto-detect any new replies/messages coming in and refresh the page automatically with AJAX. Is there a script I can find somewhere to achieve this? Thanks in advance.
To recap from the comments, these web apis will help accomplish the goal but overall the question is not answerable given the current information.
I'd like the page to be able to auto-detect any new replies/messages coming in
This can be accomplished, in theory, using the MutationObserver API though I don't know this to be available in all browsers.
refresh the page automatically with AJAX.
AJAX is not needed to refresh the page. The Location.reload() web api can refresh the page and may meet the use case in theory.
Additionally, I can infer that it is not the page but just a div on the page that needs to be appended with the update from a REST API. This can be done in JavaScript though more specific implementation is dependent on more details.

Handling first time users in react-native

Is there any configuration in react-navigation for screens I only want to display once during the life time of the app? For instance, once the app is installed for the first time, I want the help screen to appear.
If no configuration is available, then what is the best way to do it? My idea is to save a variable locally and set it once the help screen has been displayed. Once the user opens the app again this variable will be checked and based on the that the next screen will appear. The problem here is that if the user erased the app data (cache and all) then the help screen will appear again even if he is not a first time user.
Any suggestions?
People change their mobiles and sell the old ones. A new user might install the same application on the same mobile but that user should also see the help page. You can achieve this using 2 methods, one would be server based and one would be local mobile based.
1) Server Based
When the user registers or log-ins for the first time show the help page and store that the user has seen the help page on your server. Next time the user reinstalls the application on a new device or the same device check for that information and do not show the help page.
2) Local Based
Use React Native's AsyncStorage and mark the user as help seen. When the user logs-out of the application make sure to remove that key from AsyncStore so that a new user can see the help page.
My thoughts would be you use the local app based method and let the user see the help page everytime they clear their app data or reinstall the application because features change and you might also change the help page in future. So it is better to let the user see it more than once given that you give the ability to skip the help page as well :)
Using AsyncStorage is probably the best option since it will store data locally on the device and persist between sessions. However, AsyncStorage data will be erased if the user uninstalls an app.
You can persist data between app installs on iOS by using the Keychain, accessible in React Native via 3rd party libraries (https://github.com/oblador/react-native-keychain)
I don't believe there is any way to persist data between app installs on Android.

autoreload webpage on new release

I have a website in PHP which is completely ajax-based.
There is an index.php, but a part from it, all the other pages are never rendered directly into the browser. Instead, all the post and get requests are done from JavaScript through ajax. So basically, if you go to /contact.php you will not see anything. All the pages are rendered inside index.php.
There are a lot of people that use this page that are not very web-savvy and may not understand what it means when we ask them to refresh the page.
The biggest issue happens when we do a new release. Especially the JavaScript code (but not only) can be the old one in a client's webpage as they maybe haven't refreshed the page for some weeks.
I perform an svn update to publish the new code to the server. Then I refresh my page and see the new features.
However, the people that don't really know how to refresh will not see anything. I have added a big button on the page with the text "refresh", which executes a location.reload.
This may help some people, but not everyone.
How can I "force" the browser to reload itself when a new version has been published?
I would prefer something simple which does not require additional libraries or a timer.
It is also quite important that the page not refresh when the user is doing something with the page, as they may lose work when this happens.
I think you can add a version constant in your code
<?php
define(VERSION, '1.0');
And everytime you call a javascript add this extension
<script type="text/javascript" src="myfile.js?<?php echo VERSION ?>">
So when you'll update version, every js will be recalled by the navigator. Is it more clear?
You can also add a version check web service that will be called before any validate action, so you can refresh page or warn user before doing an action.
Without timer or socket.io you can't refresh page for user.

Developer.Twitter is not loading full page/css, not able to create app

I am developing web application for which i need to implement twitter login with PHP.
So, following Twitter Documentation and GoogleSearch, first i need to create app on https://apps.twitter.com/
But the problem is All app.twiiter.com page/css are not loading full.
Check out the following screenshot of my browser :
And also mainly, while creating an app same problem persist, even after inserting app details: name description etc. and after submitting, it shows an error "The form has become outdated. Copy any unsaved work in the form below and then reload this page."
Check out following screenshot of my browser :
I tried every single browser, but having same issue.
Am i the only one facing the problem ?Or twitter's developer page is having issues? Please Help.

iphone, uiwebview with JS (google maps API)

two question for you:
reading google documentation i've make an html with the JS for make a google maps api call.
I've put this file in my project, and in a TABView i read and render this file in a uiwebview.
Works great but every time i start my app and go to this view i got this message: "appleweb://someID want to use your current location".
Is my fault or is normal? why my authrization is not saved in position auth?
Second: if i must make some other request on my map and passing new data or refreshing existent data is better that i do this via javascript or there's some option in cocoa to refresh my view?
It is surely not your FAULT, and yes it is normal. user location authorization SHOULD NOT be saved because the next time user launches his app he wont be knowing that his current location is being used (just in case he wants to avoid that for whatever reason).
I dont know the answer to you second question but just a suggestion: why don't you use MapKit API provided by apple instead of going with html and js for google maps? It is pretty easy to use and theres enough documentation and sample codes available on ADC.

Categories

Resources