我正在尝试使用以下代码进行重定向:<script type="text/javascript"> window.location.href = "http://google.com" </script>FF和IE工作正常. Chrome没有. 上面的请求到http://google.com,在Chrome浏览器中获得“已取消”状态>开发工具> “网络”. 我尝试了其他几个功能:location.href = url location.replace(url) document.location = url location.assign(url) window.open(url, '_self')粘贴在本地html文件中的相同代码工作...
我希望用户在本月的第一天定向到bar.html,在本月的第二天定向到gjb.html,在本月的第三天定向到guerr.html,在其他日期定向error.html. 我究竟做错了什么?无论用户计算机上的日期如何,以下内容仅加载bar.html.<html> <script type="text/javascript">currentTime = new Date();if (currentTime.getDate() = 1)window.location = "bar.html";else if (currentTime.getDate() = 2))window.location = "gjb.html";else if (currentTime...
我有一个父页面,上面有PayPal按钮.按下按钮将触发迷你浏览器,用户可以登录并付款. 用户成功付款后,以下代码关闭PayPal迷你浏览器.// Add javascript to close Digital Goods frame. You may want to// add more javascript code to// display some info message indicating status of purchase in// the parent windowresponse.setContentType("text/html");response.getWriter().println("<script>\n alert(\"Payment Successful\...
如何将I帧位置重定向到另一个位置?任何的想法?我有这样的样本,我正在尝试做什么 我想通过该网站内的点击按钮将此位置改为另一个位置.当这个站点登录时,当我按下注销按钮时,我想回到这个页面,但仍然在这个I帧中. 这怎么可能? HTML<iframe scrolling="no" src="http://www.example.com/login"></iframe>解决方法:为您的iframe提供ID<iframe scrolling="no" src="http://www.example.com/login" id ="myframe"> </iframe>然后点击你...
我正在寻找的非常简单,一种在屏幕或窗口宽度小于950px时自动将用户重定向到不同URL的方法. 我不想使用“刷新”,因为它不推荐,我也不想使用“用户代理”,因为它长期接触我不太可靠,我不想关注更新这个. 这是我为了这个目的而到处建议的脚本,但由于某种原因它没有做任何事情:<script type="text/javascript"><!--if (screen.width <= 950) {window.location = "https://www.google.com/";}//--> </script>我也尝试过所有这些变种而没...
我是facebook api的新手,我用facebook应用程序登录但是当我进入任何页面api重定向主页面时.我想保留我的页面.例如 : 我在main / news / nba-orlando页面,我想用facebook登录,然后点击按钮然后弹出显示.如果我接受,api重定向主要我想保持主/ news / nba-orlando页面…我怎样才能做到这一点 ?FB.init({appId : '{api_id}',redirect_uri : document.URL,cookie : true,xfbml : true,version : 'v2.5' });解...
如果我有一个正常的网站,这将是一个简单的修复…但我已经在tumblr上建立了我的网站,所以我需要一个解决方法.每个页面都运行相同的代码,因此任何解决方案脚本都将在每个页面上运行..不能完全解决这个问题(我提到我总共n00b?).像这个问题有很多问题的答案,但我不能找到正确的语法我想回答这个问题…… 这里的目标是,如果有些只涉及原始域名,在这种情况下,百万larerextreme.tv – >我希望它重定向到milliondollarextreme.tv/tagged/...
我想让用户点击一个按钮并将他/她重定向到我之前使用过window.location的其他网站,但由于某种原因,这次它不能正常工作.我确定选择器是正确的,就像我改变window.location每次都提醒它警告,所以我无法弄清楚我做错了什么.$('#show').click(function(){if($('select[name="customers"]').val() == '')window.location.replace = 'http://google.com/';});解决方法:你必须使用其中之一window.location.replace("http://google.com"); /...
我将如何重写/捕获javascript重定向? 例如:window.location.href="http://example.com";值“http://example.com”将被捕获并可能被更改.解决方法:AFAIK你可以捕获这个事件,但你不能改变目标网址.您只能提示用户是否要取消重定向.为此,您可以订阅before unload event:window.onbeforeunload = function (e) {var e = e || window.event;// For IE and Firefox prior to version 4if (e) {e.returnValue = 'Are you sure you want...
在我的HTML页面上,我有一些驱动下拉菜单的Javascript代码.用户选择要下载的文件,然后按下按钮进行下载. 这是Javascript代码的一部分:var dd = document.getElementById("OSselectDropdown");var OSchoice = dd.options[dd.selectedIndex].value;if (OSchoice == "win"){window.location.href = "http://mysite.com/downloads/installer.exe";}if (OSchoice == "mac"){window.location.href = "http://mysite.com/downloads/instal...
我试图让colorbox(iframe)关闭,并让它将父窗口重定向到一个特定的页面,该页面动态地取决于彩色框中显示的图像.所以基本上每个图像旁边都有一个链接,因此用户可以点击转到图像配置文件的所有者. 我已经得到它所以它关闭彩盒但不重定向父窗口.<a href='#' onclick='parent.$.colorbox.close(); window.parent.location.href=linkurl;'> owner profile</a>任何帮助或指示将不胜感激.谢谢解决方法:试试这个:<a href="#" id="myLink">c...
我的脚本在chrome下运行正常,但不适用于Firefox. Firefox只是向我显示一个白色屏幕.必须使用POST进行重定向.<!DOCTYPE html> <html><script type='text/javascript'>//<![CDATA[ var redirect = function(url, method) {var form = document.createElement('form');form.method = method;form.action = url;form.submit();};redirect('/mywebservice/mainpage', 'post');//]]></script> </html>解决方法:您无法提交不属于该页面的表...
我正在使用Meteor和AutoForm&铁路由器. 我有一个autoform用于插入记录,我想重定向到另一个页面以在成功插入后查看记录.什么是普遍接受的方式? 如果我使用标准的autoform插件,如:{{#autoForm collection="Articles" id="articleSubmit" type="insert"}} 我看不出如何重定向? 如果我使用’method’类型,如下所示:{{#autoForm collection="Articles" id="articleSubmit" type="method"}} 然后我必须编写一个不特别干的插入方法.解...
我正在使用node.js及其socket.io模块构建一个简单的登录系统.我完成了身份验证部分,即使用MongoDB,我现在可以确定尝试登录的用户是真的还是假的.在此阶段,当我找到正版登录时,我需要将客户端重定向到不同的页面(index.html).但是,因为没有发送请求并且不期望使用socket.io事件响应,所以我无法使用 response.setHeader(…);因为我的回调函数中没有’response’参数.这是我的代码: 在客户端:<script src="/socket.io/socket...
我正在尝试使用react-router 1.0.2在react组件中执行重定向. 在我的主app.js中,我创建了一个哈希历史:import createHashHistory from 'history/lib/createHashHistory'; const history = createHashHistory(); ... ReactDOM.render(<RelayRouter history={history} routes={routes} />,document.getElementById('root') );当我执行数据库插入时,我想重定向到另一个页面.我使用的是在早期版本中使用的,但不再适用:import createHa...