这是一个简单的例子pushState和popstate事件:
<button id="example_btn">Click me</button>
<script>
$("#example_btn").click(function(){
history.pushState(
{
'url' : "example.htm"
}, null, "example.htm");
});
$(window).bind('popstate', function (event) {
if (event.originalEvent.state) {
console.log(event.originalEvent.state.url);
}
});
</script>
Run Code Online (Sandbox Code Playgroud)
触发popstate事件时,它会显示当前页面的URL.
我的问题是:
在这种情况下,如何在触发事件时获取上一页的网址popstate?
PS我试过document.referrer但它没有显示任何东西.
我试图制作一个"单行"和"纯文本" contenteditablediv.换句话说,我只是想做一个<input type="text">,但不是以这种形式出现.我怎样才能使用表格contenteditable div来呈现<input type="text">?
我想FormData通过使用jQuery AJAX 发送一个,如:
var uploadFormData = new FormData();
uploadFormData.append("name","value");
$.ajax({
url : "(URL_target)",
type : "POST",
data : uploadFormData,
cache : false,
contentType : false,
processData : false,
success : function(r) {
alert("Success!");
}
});
Run Code Online (Sandbox Code Playgroud)
但我也希望使用jQuery AJAX发送二进制数据,如:
var data = (...);
$.ajax({
url: "(URL_target)",
type: "POST",
data : data,
cache : false,
contentType: "application/octet-stream",
processData: false,
success : function(r) {
alert("Success!");
}
});
Run Code Online (Sandbox Code Playgroud)
如何将它们组合成一个数据并发送出去?
这是从我的 iPhone 8 复制的 MOV 视频文件 URL。
https://www.yangfamily.tw/attachments/IMG_3049.MOV
然后我尝试在Chrome上播放这个视频,html代码如下:
<video width="320" height="240" controls>
<source src="https://www.yangfamily.tw/attachments/IMG_3049.MOV">
Your browser does not support the video tag.
</video>
Run Code Online (Sandbox Code Playgroud)
好的,已经加载成功了。但没有显示框架,只显示控件。
It's indeed a video file, and I can play this video file and show the frames successfully on any other player. Why this MOV video file was read as an audio file in Google Chrome? (Chrome Version: 90.0.4430.93 64-bits)
Any idea?
javascript ×3
html ×2
jquery ×2
ajax ×1
css ×1
html5-video ×1
mov ×1
popstate ×1
pushstate ×1
video ×1