history.push ajax,ajax - IE history push state - Stack Overflow

本文讨论了如何在不支持pushState的IE浏览器中处理历史状态,建议使用特性检测来决定是否使用pushState。对于不支持的浏览器,可以改用更改URL或全页面刷新。虽然这可能导致IE9及以下版本的用户体验下降,但避免了链接中含有#号,从而保持页面的正确索引和美观。作者认为,牺牲动画效果以确保链接的可用性和SEO更重要。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Old but still current question. I just want to say I would recommend not to try to emulate pushState on IE.

Instead of that, you can use a feature detection :

if history.pushState is not null (browser supports pushState), you use it and load your content with nifty javascript

if history.pushState is null (browser does not support pushState), you change url / follow the link and make a full page change

Of course, this means IE<=9 users won't have all the cool animations other users have. But the question I want to ask is : do you want to see on the net links to your website containing # ?

Users may think your app is useful and paste links to it on the web. That's cool, because it brings you some google juice. Now, if that user uses IE and you use history.js, user will paste a link containing a hash.

This will defeats proper indexation of public pages of your app, and also will look ugly. My personal opinion is that having a js animation or lightbox for IE users doesn't worth those trade off.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值