jjzjj

browser-history

全部标签

javascript - react 路由器 : access history in rendered Route component

我知道有很多关于此的问题,但我似乎无法让它工作:我需要从通过路由呈现的子组件访问“历史记录”。(它从redux容器接收Prop)。我需要将历史对象传递给在每个路由中呈现的组件,这样我就可以this.props.history.push('/route')在子组件中。这个应用程序以前不太动态,所以每个Route都用component={someComponent}硬编码;但我发现在动态执行路由时,您需要使用render={()=>}.从component={}更改路线后至render={()=>...}我在子组件中丢失了历史记录。我的代码是这样的:importReact,{Compone

javascript - XMLHttpRequest : Browser support for sendAsBinary?

Firefox是唯一支持sendAsBinary方法的吗? 最佳答案 目前,我相信只有FF3+支持这个,尽管有一个workaround适用于Chrome。 关于javascript-XMLHttpRequest:BrowsersupportforsendAsBinary?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/4236153/

javascript - 结合 window.history.pushState 返回历史记录时,页面不会重新加载

当我使用window.history.pushState更改url时,返回浏览器历史记录时页面不会自动重新加载,例如通过点击“历史后退按钮”。为什么页面没有自动重新加载?我可以改变这种行为吗?这里有一小段代码来举例说明这个“问题”:Locationtestfunctionload(){varvalue=window.location.search.substr(1);document.getElementById('myInput').value=value;document.title='Locationtest-'+value;}functionset(el){window.his

javascript - redux saga 和 history.push

背景:我正在创建一个Login组件。saga.js由3个函数组成1.rootSaga。它将执行sagas里面的列表2.watchSubmitBtn。它会观察提交按钮的点击并发送一个Action。3.shootApiTokenAuth会接收派发的action并处理axios.post返回值为promise对象在行动:后端返回400给React。这种情况没问题,我可以轻松读取payload并在render()中显示。但是当返回200时。我需要让用户转到url/companies。尝试:我曾尝试将this.props.history.push('/companies');放在componen

javascript - 在 jquery ajax 上使用 history.pushstate

我有一个非常基于ajax的应用程序,其中我只有一个登录页面和主页。我的大部分链接都是“ajaxed”的,我是这样完成的://getthehrefofthelinkthathasbeenclicked,ajaxifyANYlinks$(document).on('click','.treea',function(){varlink=$(this).attr('href');//getthehrefoffthelist$.ajax({//ajaxrequesttopostthepartialViewurl:link,type:'POST',cache:false,success:funct

javascript - 在 IE 'enter' 中提交 "web browser"表单

第一浏览器下载其他浏览器有问题...IE当您在表单中按回车键时,IE8无法提交。这是我使用的:functionsubmitOnEnter(){if(browserName=="MicrosoftInternetExplorer"){varkey;if(window.event){key=window.event.keyCode;//IE}if(key==13){document.forms['myform'].submit();}}}这位于文本输入上:onkeyup="submitOnEnter()"当我按两次回车时,表单似乎提交了??但不是一次。你能帮忙吗?

javascript - 如何使用 history.js 捕获一次状态更改事件?

我在下面有一个示例代码,如果您单击链接,然后使用后退和前进,每个状态更改都会导致对statechange事件的点击越来越多。而不是我期望的那个。链接:https://github.com/browserstate/history.jshttp://docs.jquery.com/Downloading_jQuery代码:HistorystartHeadlinePage1Page1Content1Page2Page2Content2StartpageParagrafif(typeofwindow.JSON==='undefined'){console.log("Loadedjson2")

javascript - 使用javascript更改URL链接而不刷新

是否可以在不刷新页面的情况下自动将urlexample.com/4000/title-2/#!4000更改为example.com/4000/title-2?基本上是从URL中删除“/#!4000”。请注意,重要的是要删除hashbang之前的“/”,而不仅仅是hashbang。 最佳答案 不知道这对你来说是否足够以及它是否可以完全跨浏览器工作...chrome接受:location.hash="";但这会保留地址栏中的“#”在完全支持html5historyapi的现代浏览器中:window.history.replaceStat

javascript - 浏览器后退和前进按钮不使用 history.js 的 statechange 事件调用回调方法

我使用了(https://github.com/browserstate/history.js)并且有一段这样的代码History.Adapter.bind(window,'statechange',function(){varState=History.getState();alert('InsideHistory.Adapter.bind:'+State.data.myData);});functionmanageHistory(url,data,uniqueId){varHistory=window.History;if(!History.enabled){returnfalse

Javascript, 火狐 : how to disable the browser specific cell controls?

在Firefox中:当将光标置于表格单元格中时,浏览器将显示4个控件(一个位于每个单元格边框的中间)。(内容处于可编辑模式。)如何禁用这些内容?提前致谢。 最佳答案 如果您指的是在可编辑表格上获得的控件,则可以使用以下命令禁用这些控件。它适用于最近的Firefox,至少:document.execCommand("enableInlineTableEditing",null,false); 关于Javascript,火狐:howtodisablethebrowserspecificcel