prevent file from being redownloaded - javascript

I have a website, on one of its pages a file is automatically downloaded when the page is loaded
How do I prevent the file from being automatically redownloaded once he returns to this page in the following conditions
user clicks refresh on this page
user navigates away from this page, and then clicks the back button to come back to this page ?

Related

Button to load previous page with previous results

I've a page where you fill a form to search on YouTube API and returns some videos with buttons to go to another page with details about the video. Then there is a button to go back to previous page, but when clicked it returns the page as was open (Without any results). Is there a simple way to load the page with this results?
You can save the search key in session storage when the user clicks the video button. That way you can always get it back when you return to the previous page.

to stop page reload when back to previos page

How to stop page reload or refresh while I come back from view page.I am using back button where I call java script history.Go to get back to my page but the page actually got refresh and loss all data.

How to restore scripts history in javascript?

I have 2 html pages. in page A, some script is active. When the user performs some action, some of these scripts work. When Click on a button occurred, it will go to the second page. I'm going to click on the back button in page B, to return to the first page occurs, while the recent changes that have occurred with the scripts be valid. But it's not, and when i come back to the first page, the page is loaded to its original state.

Facebook like button shows old image, even after reload

The user goes to a page with image A. If he presses the Facebook like button, it displays image A next to the url. He then navigates to an edit page, changes the image to image B, and then reloads the original page. The page now displays image B. He presses the like button and it's still showing image A.
I have
<meta property="og:image" content = "image_b" />
This thread will give you the answer.
Facebook catches pages. You basically would need to have that cache refreshed in order for your page to show a different image. Since this can only be done manually I would suggest using a form variable in your header so that facebook caches more then one page/url.

back button not working after javascript redirect

I have a widget which is embedded in random sites. when the user clicks I call the server to update the click occured and the server returns redirect to the correct page. The problem is that the Back button of the browser no longer works.
I use location.href for the redirect.
I tried location.replace -which keeps the back button , but it goes to the page before the page in which the widget was clicked (it replaces it with the new page).
How can I do the page switch after reporting to the server and still allow the back button to work?
You cannot go back to a page that auto-redirects. That's just a broken back button and a frustrated user.
User goes to page A.
User clicks on link to page B.
Page B automatically redirects to page C with window.location.
User hits back button and momentarily goes back to page B.
Page B automatically redirects to page C with window.location.
User hits back button and momentarily goes back to page B.
Page B automatically redirects to page C with window.location.
User is sad.
Obviously this doesn't work. It has to work like this instead:
User goes to page A.
User clicks on link to page B.
Page B automatically redirects to page C with window.location.replace().
User hits back button and goes back to page A.
User is happy.
You must auto-redirect with window.location.replace() if you want the back button to work.

Categories