java 获得http下载文件的真实名称

java 获得http下载文件的真实名称,第1张

有两种获取链接文件名的方法:

第一种:从连接URL,从描述中获取

第二种:如果第一种获取不到,可以从URL地址中获取

比如这种地址:

>

就用你说的方法,我写的例子如下:

<form>

<input type=text name=xxx><input type=submit>

</form>

<script language=javascript>

documentwriteln(locationhref,'<br>');

var s=locationhref;

s=sreplace(/\$/,'')

s=sreplace(/^\//,'')

documentwriteln(s,'<br>');

</script>

设置或获取对象指定的文件名或路径。

<script>

alert(windowlocationpathname)

</script>

设置或获取整个 URL 为字符串。

<script>

alert(windowlocationhref);

</script>

设置或获取与 URL 关联的端口号码。

<script>

alert(windowlocationport)

</script>

设置或获取 URL 的协议部分。

<script>

alert(windowlocationprotocol)

</script>

设置或获取 href 属性中在井号“#”后面的分段。

<script>

alert(windowlocationhash)

</script>

设置或获取 location 或 URL 的 hostname 和 port 号码。

<script>

alert(windowlocationhost)

</script>

设置或获取 href 属性中跟在问号后面的部分。

<script>

alert(windowlocationsearch)

</script>

设置或获取对象指定的文件名或路径。

<script>

alert(windowlocationpathname)

</script>

设置或获取整个

URL

为字符串。

<script>

alert(windowlocationhref);

</script>

设置或获取与

URL

关联的端口号码。

<script>

alert(windowlocationport)

</script>

设置或获取

URL

的协议部分。

<script>

alert(windowlocationprotocol)

</script>

设置或获取

href

属性中在井号“#”后面的分段。

<script>

alert(windowlocationhash)

</script>

设置或获取

location

URL

hostname

port

号码。

<script>

alert(windowlocationhost)

</script>

设置或获取

href

属性中跟在问号后面的部分。

<script>

alert(windowlocationsearch)

</script>

以上就是关于java 获得http下载文件的真实名称全部的内容,包括:java 获得http下载文件的真实名称、[闲聊]如何快速把url和文件名互相转换、如何利用Js获取当前地址的文件名并做相应 *** 作啊等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/9539313.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-29
下一篇 2023-04-29

发表评论

登录后才能评论

评论列表(0条)

保存