我有一个要求在<script type="text/javascript">
var offset = new Date().getTimezoneOffset(); //get client timezone differance with UTC
offset *= -1; // change sign
offset *= 60; // convert into second
console.log(offset);
</script>
<?php
echo "<br/><br/>";
$a = "<script>document.write(offset)</script>"; //getting value in string
echo $a; // this works and print : 19800
echo "<br/>";
settype($a, "integer");
echo $a; // print 0
?>
向后动作上添加观察。 WKWebView
执行后退而不是调用我的方法。我怎么能这样做?
如何检查WKWebView
正在做后退或前进动作?
用户在WKWebView
上执行后退操作的时间是多少?我该如何计算?
答案 0 :(得分:0)
WKNavigationDelegate协议的方法可帮助您实现在Web视图接受,加载和完成导航请求的过程中触发的自定义行为。
您可以使用该委托方法:
webView(_:decidePolicyFor:decisionHandler:)
实施将如下:
if(navigationAction.navigationType == .backForward)
{
if navigationAction.request.url != nil
{
//do what you need with url. If Your URL is last visited then It's back.
}
return
}
有关详细信息,请参阅:Link