首页 \ 问答 \ 如何在Javascript中获取以前的URL?(How to get the previous URL in JavaScript?)

如何在Javascript中获取以前的URL?(How to get the previous URL in JavaScript?)

有没有办法得到以前的网址在JavaScript? 这样的东西

alert("previous url is: " + window.history.previous.href);

有什么事吗? 还是应该把它存储在cookie中? 我只需要知道,所以我可以从以前的URL到没有锚点的所有URL的转换。


Is there any way to get the previous URL in JavaScript? Something like this:

alert("previous url is: " + window.history.previous.href);

Is there something like that? Or should I just store it in a cookie? I only need to know so I can do transitions from the previous URL to the current URL without anchors and all that.


原文:https://stackoverflow.com/questions/3528324
更新时间:2022-05-12 09:05

最满意答案

尝试序列化:

file_put_contents($filename, serialize($array));

并阅读:

$array = unserialize(file_get_contents($filename));

Try serialize:

file_put_contents($filename, serialize($array));

And to read:

$array = unserialize(file_get_contents($filename));

相关问答

更多
  • 尝试序列化: file_put_contents($filename, serialize($array)); 并阅读: $array = unserialize(file_get_contents($filename)); Try serialize: file_put_contents($filename, serialize($array)); And to read: $array = unserialize(file_get_contents($filename));
  • 问题是( 正如您所注意到的 )数组顺序和DOM顺序的断开连接。 您只能使用该数组来创建DOM元素。 它们不是以某种方式联系在一起,因此一个人会发生什么影响另一个人。 您必须通过清空容器并重新绘制元素或重新排列现有DOM元素来手动重绘dom。 例如,您可以使用一个函数来清除#list元素,然后附加已排序的节点。 function displayData(array) { var list = $("#list").empty(); $.each(array, function () { ...
  • MySQL无法直接从PHP的内存中读取。 您需要使用tempnam()创建外部文件。 然后MySQL可以读取该文件。 您还可以创建一个临时文件,并找出此问题中提到的文件名。 tempnam()的示例显示了如何写入该文件:
  • 您尝试添加一个字符串和一个会引发ValueError的数字,尝试使用此代码来处理异常: import csv f = open('IT_Programming_data.csv') csv_f = csv.reader(f) score = [] for row in csv_f: try: num = int(row[1].strip()) # try to switch type score.append(num) except Exception,error: # fai ...
  • 在您只读取文件时,请尝试使用此代码计算大于或等于36的数字。 更改createArray方法中的代码或在任何地方编写以下逻辑。 我试过执行这个程序。 它按预期工作。 见下面的代码 import java.util.*; import java.io.*; public class Test { //Name this to your actual class name public static void main(String[] args) throws Exc ...
  • 一个绝对用户友好的库 - http://www.codeproject.com/Articles/9258/A-Fast-CSV-Reader One absolutely user-friendly lib - http://www.codeproject.com/Articles/9258/A-Fast-CSV-Reader
  • 不太难。 JSON看起来比实际上更令人生畏。 您可以使用jQuery get JSON方法来调用JSON文件。 您需要确保它是有效的JSON。 您可以访问http://jsonformatter.curiousconcept.com/查看此信息。 一旦你有一个有效的JSON文件可以使用,你就可以这样调用: //call jQuery