browser-history

Browser History Management

不打扰是莪最后的温柔 提交于 2019-12-06 10:02:14
I'm trying to find a clean solution to working with the browser history in the most effective way. (I'm using GWT, but this question is really more general than that.) Here's my situation (I would think it's pretty standard): I have a web application that has several different pages/places/locations (whatever you want to call it), which I display in response to changes to the browser history. Beyond the usual "Home", "Features", "Contact", etc. which are mostly static HTML pages, there is a "User" section, where people can log into their user accounts and (let's call it) a "Project" section,

Jquery: mark links as visited without opening them?

天涯浪子 提交于 2019-12-06 03:55:39
I have no intention of just altering the link (I hear that's impossible, but if it's not I'd love to know how). I'm fine with adding it to the the browser history if that needs to be done. I'd like to loop through all <a> 's on a page and change their state to visited. For example: $("a").each(function(){ //mark as visited (somehow?) }); Essentially creating a "Mark All as Read" button on my page. Any ideas? You could ... 1) Try using AJAX (ie. $.get(a.href)), but I don't know if that would actually work. 2) Try styling the links to look visited (by changing their CSS "color" attribute),

Is there a way in History.js to know when the back button was pressed

丶灬走出姿态 提交于 2019-12-06 03:07:05
问题 I've started to test History.js. After understanding how it works and that there is no popstate , instead there is statechange . I'm looking for a way to differ when the back button of the browser has been pressed. The reason is that I need to know the URL before the state moved, from the one I'm going to. With the gist the project includes, only the URL we go to is looked. I hope the solution is not to track latest URL visited in a global variable. Thanks 回答1: I found the solutions on github

Javascript/jQuery detect hash change only on browser back/forward button click

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 02:57:53
问题 Is it possible to detect the hashchange only on a browser history change (i.e. Back or Forward button)? I have seen the onBeforeUnload event, but this event does not fire on hash change, as the window is not unloading. The hashchange event obviously fires anytime the hash changes. Any fix? Preferably without a plugin. I have seen the jQuery history plugin, but am looking for the simplest solution. Thanks for the help. 回答1: Take a look at the window.onhashchange event. It is not currently

why does changing “module -> rename to” attribute in .gwt.xml file give error

末鹿安然 提交于 2019-12-05 21:50:15
I am able to create and run a simple GWT application by creating all the files myself. It works fine and I am able to see the correct display. I tried playing around the code to enhance my knowledge. What I noticed is that, once I run my app with say module rename to value " testhistory " it works fine. But after that if I change rename to 's value to say " historytokentest " the app gives errors like "Unable to find ' testhistory.gwt.xml ' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?" If I change the rename to 's value back to " testhistory

javascript history.back losses the search result

久未见 提交于 2019-12-05 20:09:18
Page A: $(document).ready(function () { bindData(); }); function bindData() { $('#searchbtn').bind('click', function () { SearchResult(); }); } function SearchResult() { ajax call... } Page A HTML: <input type="button" id="searchbtn" /> Page B Details---> this page comes after selecting a specific search result from page A search list <a href="javascript:history.back();">Back</a><br /> Now when I go back to the Page A I can see my search criteria's as they were selected but the result Div is gone. What I am trying to do is I want the search list to stay when the Page comes back. I think what I

AJAX Links Not Detected By A:Visited

爱⌒轻易说出口 提交于 2019-12-05 15:50:42
I'm noticing that a:visited styles don't work on links that are requested via JavaScript. On a standard user click though, the exact same link registers as visited, both immediately and on subsequent refreshes. I'm not sure if this is unique to jQuery Mobile (where I first encountered it) or whether it's a browser limitation that I didn't know about? You probably need to change the location.hash if you want it to work with history and visited links styling. Keep in mind that the visited links styling works somewhat inconsistently between browser after the visited links based browsing history

how to catch a state change event ONCE with history.js?

若如初见. 提交于 2019-12-05 09:15:06
I have an example code below where if you click the links, then use back and forward, each state change will cause more and more hits on the 'statechange' event. Instead of the one that I expect. Links: https://github.com/browserstate/history.js http://docs.jquery.com/Downloading_jQuery Code: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>History start</title> </head> <body> <h1>Headline</h1> <hr> <div id="menu"> <ul> <li> <a href="page-1">Page 1</a> <div style="display:none;"> <h2>Page 1</h2> <p>Content 1</p> </div> </li> <li> <a

How to insert content script in google chrome extension when page was changed via history.pushState?

你离开我真会死。 提交于 2019-12-05 07:44:31
I'm creating a small google chrome extension for website, and I want to change some html on particular pages. The problem is that website load his content via ajax, and heavy use history.pushState API. So, I added this thing to manifest: "content_scripts": [ { "matches": ["http://vk.com/friends"], "js": ["js/lib/jquery.min.js", "js/friends.js"], }, ] Everything works fine when I'm opening page first time or reloading it. But when I'm navigating between website pages, chrome don't insert my scripts on "/friends" page. I think this happening because the URL actually don't changing. They use

binding popstate event not working

◇◆丶佛笑我妖孽 提交于 2019-12-05 05:46:31
I have tried to type this code into the browser's console: window.onpopstate = function() {alert(1);} and then click the back button. No alert has shown. Am I doing something wrong? Or is it not allowed to bind popstate event to a page from console? Using Chrome 24 and Firefox 18 Type this into the console window.onpopstate = function() {alert(1);}; history.pushState({}, ''); then click the back button. I prefer adding the popstate listener as follows, to prevent overwriting of what's already in window.onpopstate : window.addEventListener('popstate', function(){alert(1);}); 来源: https:/