window.location.replace 和 window.location.href 的区别

昨天在处理一个具有返回功能的按钮时花了一些时间,就是返回到用户搜索的前一页,我用的是 window.location.go(-1),这就是正正经经的浏览器返回到前一条浏览记录的做法。可是有几个返回按钮却一直失灵,点击之后,可以看到浏览器刷新,但是还是停留在原来的页面。
仔细查看代码,终于发现了原因。就是用户从上一个页面 a 跳转到目前看到的这一个页面 c,其实中间还有一个页面 b,只是用户看不到,因为从 a 跳转到 b 后,执行 b 的脚本,b 的脚本有下面这句:

window.location.href = "c.html";

所以页面嗖的一下就跳到了 c 页面,但是浏览器记录却记录了三个页面:a, b, c.
这个时候点击返回按钮从 c 就是返回到 b,而 b 又会马上跳转到 c,所以就出现了点击返回按钮,页面刷新后,还是停留在原来页面的情况。
解决方案就是把上面重定位的脚本换成下面这句:

window.location.replace("c.html");

window.location.replace(url) replaces the current location in the address bar by a new one. The page that was calling the function, won’t be included in the browser history. Therefore, on the new location, clicking the back button in your browser would make you go back to the page you were viewing before you visited the document containing the redirecting JavaScript.

window.location.replace(url) 将目前浏览器的地址替换掉,调用这个方法的网页,将不会被写入浏览记录。所以,网页 b 不会被写入浏览记录,从网页 a 经过 b 跳转到 c,再点击返回按钮将跳转到 a.

  • 11
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
Terraria的MOD扩展,仅限1.3.5使用 Automatic Install: To install tModLoader, extract the zip achive containing this README.txt file to a temporary folder and then simply run the tModLoaderInstaller.jar file in that folder. Java 1.8 or higher is required for the installer to run. The installer will make a window pop up, informing you of either success or failure. If needed, the installer might ask you where you installed Terraria. If for some reason the installer doesn't work, you'll need to follow the Manual Install instructions. Manual Install: If the installer for some reason does not work, or if you do not want to install/upgrade Java, you may also do a manual install. Steam Manual Install: 1. Go to the Terraria install folder (the one containing Terraria.exe, not the Saves folder). For most people, this will be "C:\Program Files (x86)\Steam\SteamApps\common\Terraria". If you can't find it, view this video: https://gfycat.com/SelfreliantAssuredIsabellineshrike 2. Back-up your vanilla Terraria.exe if you haven't already. To do this, rename the "Terraria.exe" file in the install folder to "Terraria_v1.3.5.3.exe". Make sure you don't accidentally rename it to "Terraria_v1.3.5.3.exe.exe", this is a common mistake because Windows hides file extensions by default. If you are unsure, enable file extensions to verify: https://gfycat.com/TheseSameGrasshopper 3. Copy all of the files from the temporary folder (or zip archive) into the install folder. You'll need to make sure to replace files if asked: https://gfycat.com/EqualFaithfulAfricanharrierhawk GOG Manual Install: For GOG installs, follow the Steam Manual Install instructions above but with the location of your GOG install of Terraria. This is likely C:\GOG Games\Terraria. Don't skip the backing up vanilla "Terraria.exe" step or it won't work. Run tModLoader: To run tModLoader, run Terraria as normal from Steam. Do not attempt to run it from the temporary folder. If you see Mods or Mod Browser on the main menu in Terraria, you have successfully installed tModLoader. Uninstall/Switch back to un-modded Terraria: If you want to play un-modded Terraria or join an un-modded Terraria server, you can't use tModLoader. You can simply launch the "Terraria_v1.3.5.3.exe" file in the install directory to launch the vanilla Terraria Client. If that file launches tModLoader or you wish to permanently revery to un-modded Terraria, you need to use steam to "verify game integrity" which will restore the files back to the un-modded Terraria. (You'll need to reinstall tModLoader later.) See this video to see how to do that: https://gfycat.com/RapidBelovedFrog Dedicated tModLoader server: If you are installing tModLoader onto a machine that will be running a dedicated server, you'll need to install the un-modded Terraria server first: http://terraria.org/server/terraria-server-1353.zip After installing, you can follow the manual install instructions to copy the tModLoader files into the folder you installed the server into.
wing 你懂的不懂也不会下了。 Microsoft WinG version 1.0 -------------------------- This file describes known bugs, gotchas, and helpful hints for the WinG Version 1.0 final release. ISVs may want to distribute portions of this readme file that describe configuration bugs along with shipping products that use WinG. WinG version 1.0 provides fast DIB-to-screen blts under Windows 3.1, Windows for Workgroups 3.11, Windows 95, and Windows NT version 3.5. WinG will not run on Windows NT version 3.1 or on earlier versions of Windows. WinG requires a 386 or better processor to run. WinG will not run on a 286. If you have problems with WinG, please run the wingbug.exe file in the bin directory of the SDK and send the generated report to [email protected]. Updated information on WinG is available on CompuServe in the WINMM forum and on ftp.microsoft.com. Known Bugs And Limitations -------------------------- The following are known problems with or useful tidbits of information about WinG version 1.0. - On Windows 3.1, WinGBitmaps must be 8 bits per pixel and must be created with full 256 entry color tables. - WinGDCs are NOT palette devices. You must change their color tables using WinGSetDIBColorTable, not SelectPalette. - WinGBitBlt and WinGStretchBlt only support bltting from WinGDCs to the screen. - Using BitBlt and StretchBlt to blt from one WinGDC to another can be very slow when a clipping region has been selected into the destination. - WinGBitBlt and WinGStretchBlt may return different values than StretchDIBits for identical blts. - A few GDI APIs do not work correctly with WinGDCs: StretchDIBits will not blt 24bpp and 16bpp DIBs into an 8bpp WinGDC. FloodFill with a NULL brush draws incorrectly FloodFill outside of the bounds of a WinGBitmap can flood the entire image Brushes created with CreatePatternBrush with a WinGBitmap fault when selected into a WinGDC on Win3x - use CreateBitmap(8,8,1,8,0) DrawIcon will crash

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值