标签: navigator

(Javascript)所有浏览器的"navigator.appName"值列表?

navigator.appName为所有常见浏览器的值返回什么值?

navigator.appNameFirefox 的价值是Netscape.

为IE,Firefox,谷歌Chrome,Safari,Opera,Flock等返回什么值?

javascript browser browser-detection navigator

7
推荐指数
2
解决办法
2万
查看次数

如何使navigator.sendBeacon使用get方法

我想在客户的网站中使用navigator.sendBeacon。但是它使用的是POST方法,并且请求未到达服务器,因为请求url的域不同。我尝试了使用sendBeacon()的不同方法,但是所有方法都使用POST方法。

  1. var data = new FormData();
    navigator.sendBeacon(myurl,data);

  2. navigator.sendBeacon(myurl,“”);

  3. navigator.sendBeacon(myurl);

有没有一种方法可以使用sendBeacon()进行GET调用?还是有任何方法可以在跨域环境中使用sendBeacon()。

javascript browser cross-domain navigator

7
推荐指数
2
解决办法
1593
查看次数

是否可以使用 navigator.pop 刷新或重新加载页面...例如第 1 (nav.push=>2) 页到第 2 页,然后从第 2 (nav.pop, value) 返回到第 1 页?

我想使用 navigator.pop 将值从第二页传递到第一页,并使用新值initstate或任何其他解决方法刷新或重新加载我的第一页?

我能够在第一页中获取这些值,但无法使用新值刷新或重新加载页面,initstate其中我想在 API 中传递新数据并获取响应...

有什么帮助吗?

我正在从此重定向到列表页面...

getBrand(BuildContext context) async {
    tempBrand = await Navigator.push(context,
        MaterialPageRoute(builder: (context) => BrandList(widget.subCatID)));
    selectedBrand = tempBrand.name;
    selectedBrandID = tempBrand.id;
  }
Run Code Online (Sandbox Code Playgroud)

现在我在这里传递这些值 navigator.pop

在此处获取价值并传回第一页。

Container(
          padding: EdgeInsets.all(10),
          child: ListView.separated(
              separatorBuilder: (context, index) =>
                  Divider(color: Color(0xffcccccc)),
              itemCount: prodBrands.length,
              itemBuilder: (BuildContext context, int index) {
                return GestureDetector(
                  child: InkWell(
                    onTap: () {
                      tempProdBrand = ProdBrandListModel.Message(
                        id: prodBrands[index].id,
                        name: prodBrands[index].name,
                      );

                      Navigator.pop(context, tempProdBrand);

                    },
                    child: Container(
                      child: Text(prodBrands[index].name),
                      padding: EdgeInsets.all(10.0),
                    ),
                  ),
                ); …
Run Code Online (Sandbox Code Playgroud)

android navigator dart flutter

7
推荐指数
1
解决办法
1万
查看次数

7
推荐指数
0
解决办法
1720
查看次数

如何使用路由处理 Flutter 中的深度链接

我正在尝试构建深度链接功能,到目前为止,应用程序的初始启动和从深度链接检索参数进展顺利。

但是,在深度链接到应用程序后,我在导航到屏幕时遇到问题。我该怎么做?

我的代码如下所示:

void main() { 
    runApp(MyApp()); 
}

class MyApp extends StatefulWidget {   
    @override   
    _MyAppState createState() => _MyAppState(); 
}

class _MyAppState extends State<MyApp> with SingleTickerProviderStateMixin {   
   Uri _latestUri;  
   Object _err;

  StreamSubscription _sub;

  @override   void initState() {
    super.initState();
    _handleIncomingLinks();
  }

  @override void dispose() {
    _sub?.cancel();
    super.dispose();   
  }

  void _handleIncomingLinks() {
    _sub = uriLinkStream.listen((Uri uri) {
      if (!mounted) return;
      print('got uri: $uri'); // printed: got uri: myapp://?key1=test
      setState(() {
        _latestUri = uri;
        _err = null;

        Navigator.pushNamed(context, 'login'); // This doesn't work because …
Run Code Online (Sandbox Code Playgroud)

deep-linking navigator flutter

7
推荐指数
1
解决办法
1万
查看次数

将变量保存在navigator.geolocation.getCurrentPosition之外?(JavaScript的)

我正在尝试使用js的范围从navigator.geolocation.getCurrentPosition中提取变量

var lat;
function callback (position) {
    lat = position.coords.latitude;
}
navigator.geolocation.getCurrentPosition(callback,fail,{timeout:10000});
// after getCurrentPosition succeeds
alert(lat); // this alerts null
Run Code Online (Sandbox Code Playgroud)

由于范围,上面的代码无法在lat变量中存储position.coords.latitude.有没有办法做到这一点?

javascript geolocation navigator w3c-geolocation

6
推荐指数
1
解决办法
4662
查看次数

有没有办法用javascript检测用户是否使用wifi或蜂窝数据?

我希望仅当用户连接到 wifi 时视频才能在网站上自动播放。我知道 navigator.connection api - 但它在 safari 上不可用,而且它只告诉你连接的速度而不是类型。

javascript connection navigator

6
推荐指数
1
解决办法
2606
查看次数

当用户在 android 上取消本机选择器时,navigator.share 不会解决或拒绝

因此,我们正在Ionic v3 PWA中实现navigator.share()https://developers.google.com/web/updates/2016/09/navigator-share)。

它可以工作,但是我们遇到了一个我们不知道如何解决的小问题:当 navite 共享选择器弹出时(用户可以选择收件箱、gmail、twitter 等),然后用户按下 android 上的后退按钮(忽略出现的本机模式),该函数不会触发承诺中的任何响应。不是成功,不是错误。

这里的问题是我们在调用 navigator.share 函数之前显示了一个加载微调器,如果用户在那个精确的时刻按下后退按钮,我们无法触发隐藏加载微调器的函数。

这是我们实现该功能的代码部分:

public share(title: string, message: string, url: string) {
    // if it's mobile & web (ie: chrome on android)
    if (this.isMobileWeb === true) {
        this.showLoading();
        if ((navigator as any).share) {
            (navigator as any).share({
                title,
                message,
                url,
            })
                .then(() => {
                    console.log('Success share');
                    this.hideLoading();
                })
                .catch((error) => {
                    console.log('Error share', error);
                    this.hideLoading();
                });
        }
        else {
            console.log('navigator.share() not supported.');
            this.hideLoading();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

使用此实现,如果用户在本机共享模式出现时按下后退按钮,则不会引发成功或错误。这段代码有什么问题吗?

我还尝试在函数内添加另一个回调 …

javascript navigator progressive-web-apps ionic3 android-chrome

6
推荐指数
1
解决办法
2261
查看次数

Flutter - 如何在 TabBarView 的主体内导航?

我有一个包含项目列表的 TabBarView,我为每个项目分配了一个 Navigator.push 方法。目前这个方法会跳转到一个新页面。

我的问题是,是否可以导航到 TabBarView 主体内的新页面?这意味着我想导航到另一个页面,同时将所有顶部应用栏和 BottomNavigationBar 保留在屏幕上。

tabbar navigator flutter flutter-layout

6
推荐指数
1
解决办法
2119
查看次数

打字稿权限中的 navigator.canShare() 被拒绝

我正在构建 Angular8 PWA,并使用网络共享来共享文本,效果很好。\n自 2019 年 5 月起,Chrome 还支持\n文件共享

\n\n

但是,尝试在 Typescript 中构建文件共享时遇到以下错误:

\n\n

NotAllowedError:权限被拒绝

\n\n
let navigator: any;\nnavigator = window.navigator;\nconst title = "myTitle";\nlet data = {\n  title: title,\n  text: text,\n  url: url,\n  files: []\n};\nconsole.log(data);\n\nif (navigator.share) {\n  fetch(url)\n    .then(res => res.blob()) \n    .then(file => {\n      const fileName = data.text + ".mp3";\n      const options = { type: "audio/mp3" };\n      const newFile = new File([file], fileName, options);\n      data.files.push(newFile);\n      console.log(data);\n//lastModified: 1564912016680\n//lastModifiedDate: Sun Aug 04 2019 11:46:56 GMT+0200 (Mitteleurop\xc3\xa4ische //Sommerzeit) {}\n//name: "myName.mp3"\n//size: 40643\n//type: "audio/mpeg"\n//webkitRelativePath: …
Run Code Online (Sandbox Code Playgroud)

google-chrome navigator typescript progressive-web-apps

6
推荐指数
1
解决办法
5758
查看次数