Question

I would like to ask for your opinion on the topic. I can make my page refresh with both of these methods, but I do not know if they have any drawbacks. So, which one should I use?

Edit:

I'm talking about header('Refresh:0') in PHP and location.reload() in javascript.(Sorry, I forgot them first)

Était-ce utile?

La solution

The draw back with doing this via JavaScript is that you are limiting this feature to users who do not have JavaScript running in their browser. If it's important that the page refresh for all users then I would suggest not doing it via JavaScript.

Doing it via PHP would run for all users, but the bigger question is why do you need to refresh the page? And could you achieve the same thing without refreshing the page?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top