Leaving a asp.net application then hitting back isn't working - html

I have an asp.net application and am experiencing a surprising behavior.
Whenever I leave one particular page in the application, The back button starts behaving in the following way:
hitting back (which should take me to the offending page) makes the current screen flash - as if going back - but then reloads the current page instead.
It doesn't matter how I leave that page I see this effect. If I click on a link on the offending page and hit back, same thing. If I am on the offending page and type in a new address in the address bar, then hit back, same thing. It doesn't matter if I go to another page in the same application or an external application, same thing.
I tried using fiddler to see what is going on, and all that I see when I hit back, is all of the external links (css, jquery, etc) get reloaded on the current site. I don't see a 320 from the offending page at all.
Note: disabling Active Scripts hides this symptom.

Most likely the external page either is tampering with your browser history (via JS) and setting the same page as the last page in your history when the site is being loaded, or it has another page set between that redirects to the page you are seeing, and when you click back you are loading the redirect page again.
Try to disable JavaScript and see if it is still happening. If yes, try to analyse the first load of the page with fiddler and see if another page is redirecting you.

False alarm:
This is an inherited project and I hadn't read all the code. There is javascript that says:
<script type="text/javascript">
if (window.history.forward(1) != null)
window.history.forward(1);
</script>
Problem solved.

Related

Is there a way to prevent Chrome from replacing a bookmarklet's favicon when the bookmarklet performs a redirect?

I've been working on a bookmarklet that performs some logic and then redirects the user to a different page. I'm running into an issue where, after the redirect, Chrome is replacing the icon of the bookmark with the favicon from the target of the redirection.
I'm trying to preserve the original icon on the bookmarklet and so am wondering if there is any way that I can prevent this behaviour?
As an example. Bookmarklet starts off looking like this:
If the bookmarklet were to redirect the user to Stack Overflow then on clicking the bookmarklet icon is replaced:
I've tried a couple of approaches to perform the redirect, all of which have this behaviour:
Bookmark is a link to a server-side page that performs the redirect by returning a 302 with a Location header
Bookmark is a link to a server-side page that executes JavaScript on page load that performs the redirect using window.location.replace
So far I have a couple of other approaches which avoid this particular issue, but have other downsides of their own:
Bookmark is a link to a server-side page that executes JavaScript on page load to perform the redirect using window.location.assign - if user click the back button they are taken to my page which then redirects them again, and can result in the user getting stuck in a loop
Bookmark is a javascript: link which makes a fetch request to perform logic in the background and then goes to the target page using window.location - this works OK, except for on a new blank tab where JS bookmarks are no longer allowed.
It should be possible to prevent the replacing of favicon for some time for a redirect,by configuring the caching time:
* https://web.dev/service-worker-caching-and-http-caching/
* https://stackoverflow.com/questions/5799906/what-s-the-difference-between-expires-and-cache-control-headers

automatically refresh client browser if server page has changed

I could not find any useful solution for my TYPO3 extension.
The extention gets new informaion about every 3 minutes.
Right after the page on the server is changed, the browser should be trigged to refresh page, or better only the part which is embedded into a div section.
I have seen several pages on the internet, which always automatically update the page content.
Has anybody already done it?

Trying to delete index.html document but stays when I refresh the page

I'm very new to programming and am having some issues with HTML/CSS. I have this index.html file that I made which is composed of a basic template and copied code navbar example from off of twitter bootstrap. I am launching this page from off of my chrome browser.
The issue I'm running into is that no matter how much content I delete off of this index.html document and then hit "CTRL+S", when I refresh the page, the content on the webpage still appears the same. It's gotten to the point where I only have !DOCTYPE html and html but the content still reloads/loads/doesn't change. Is it possible that the page is still around on local storage? I tried deleting my browser cache to no avail.
Please let me know if there is anything I can do to configure it so I can delete a portion of content at one time (that way I can sort of learn what each component, class, id does).
It may be saved to your cache. Some website builders have a "Save To Cache" autosave, and you need to clear this, they should provide a button. If you're doing it yourself simply clear your cache in your Chrome Browser by going to the three vertical dots on the top right of your page -> Down to Settings -> Down to Advanced (Requires A Click) -> Down to Clear Browsing Data -> Select only Cached Images and Files -> Select a Day or Week to Be Safe. And when you reload your webpage now, it should be resolved.

How do I get Chrome to cache my HTML/CSS changes?

My web application makes changes to the CSS dynamically with Javascript, in response to user input. When the user navigates away from the updated page, then hits BACK, it reloads the page from the disk cache but the CSS changes are gone. So the page looks like it did before the user input.
Is this normal? Is there a way to get Chrome to cache the updated HTML that includes my CSS changes?
This is not related with Chrome. If CSS rule is changed by end user input (with JavaScript CSS operation) and nothing else is done, these CSS rule update (the latest CSS rules) is stored in browser memory, which is cleaned when page refreshes.
To make these updated-CSS "cached", you need to make it persistent by store it in LocalStorage (browser side) or Database in server.

Get rendered source code from web components site?

I just tried something rather trivial: get the source code of a web page (by saving it) and count how often a certain phrase occurs in the code.
Turns out, it doesn't work if that page uses Polymer / web components. Is this a browser bug?
Try the following: Go to http://www.google.com/design/icons/ and try to find star_half in the code (the last icon on the page). If you inspect the element inside of Chrome or Firefox, it will lead you to
<i class="md-icon dp48">star_half</i>
but this won't be in the source if you copy the root node or save the html to disk.
Is there a way to get the entire code?
Reason for this behavior is probably how source viewing( and source saving as well?) works for browser and because shadow roots are attached to web components on the client side.
When you press ctrl-u on a web page, browser essentially does a network call again on the same url to fetch a copy of what server returned when you hit that url.
In this case, when this page renders, browser identifies the component icons-layout and then executes code to attach a shadow-root to this node. All of this happens when your page reaches the client(browser).
When you are trying to save this page, you are saving what server returned not current state of the page. You'll see same behavior if you fire up chrome console and try to save an icons-layout node.
Is there a way to get the entire code?
I don't know how to do it from browser but phantomjs provides a way to save client side rendered html.