Internet Explorer/Edge无法发送带有URL的片段 [英] Internet Explorer / Edge not sending fragment with URL

查看:90
本文介绍了Internet Explorer/Edge无法发送带有URL的片段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个公司需要在最重要的浏览器(Chrome,Firefox,Safari,IE,Edge)上部署的网站.

I am currently developing a website my company needs to deploy on the most significant browsers (Chrome, Firefox, Safari, IE, Edge).

网站由单个index.html页面组成,其内容将根据哈希码进行替换.这意味着当我要求index.html#102时,div的内容将替换为contents [102].

The website consists of a single index.html page, with a whose content is being replaced depending on the hash code. That means when I ask for index.html#102, the content of the div gets replaced with, say, contents[102].

我的问题是:当询问"file:///.../index.html#102"(网站将存储在本地)时,Internet Explorer(10、11)和Edge摆脱了#102并实际要求输入"file:///.../index.html".因此,我基本上每次都进入首页... Chrome,Firefox和Safari都要求输入"index.html#102"(太棒了!),IE和Edge是唯一删除#102"的人.

My problem is : when asking for 'file:///.../index.html#102' (the website will be stored locally), Internet Explorer (10, 11) and Edge get rid of the #102 and actually ask for 'file:///.../index.html'. So I basically end up on the homepage every single time... Chrome, Firefox and Safari all ask for 'index.html#102' (awesome !), IE and Edge are the only ones deleting the '#102'.

您碰巧知道为什么吗?我整天都在寻找答案,并尝试针对类似问题提供解决方案( URL中的片段ID无效 https://www.daniweb.com/programming/web-development/threads/428644/url-hash-gets-removed-in-ie-after-redirect https://blogs.msdn.microsoft.com/ieinternals/2011/05/16/url-fragments-and-redirects/),但没有一个起作用.

Do you happen to know why ? I spent my whole day looking for an answer, and trying the solutions provided for similar issues (Keeping URL Fragments when redirecting in Internet Explorer, Fragment ID in URL Not Working, https://www.daniweb.com/programming/web-development/threads/428644/url-hash-gets-removed-in-ie-after-redirect, https://blogs.msdn.microsoft.com/ieinternals/2011/05/16/url-fragments-and-redirects/) but none of them worked.

我了解哈希码是本地代码,永远不会发送到服务器:IE/Edge是否认为我的请求已发送到服务器?

I understand hash codes are local and will never be sent to servers : is it possible that IE / Edge think my request is sent to a server ?

我是一名初学者开发人员,试图在这些问题上帮助公司,这不是我的全职工作,所以我认为我可能已经错过了一些关键信息供您帮助我==随时问有关详细信息.

I am a beginner developer, trying to help the company on those issues, this is not my full-time job, so I reckon I might have missed a few critical pieces of info for you to help me = feel free to ask for details.

推荐答案

在表单标记中,仅对IE添加属性 onsubmit ="window.location.reload()"

In the form tag add attribute onsubmit="window.location.reload()" for only IE

或者您可以使用jQuery $(yourfoemid).attr('onsubmit',window.location.reload());

or you can add it with jQuery $(yourfoemid).attr('onsubmit',window.location.reload());

,也可以将其写在 document.ready 上.

这篇关于Internet Explorer/Edge无法发送带有URL的片段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆