Chrome打包的应用本地根html链接

Chrome打包的应用本地根html链接

本文介绍了通过Sandbox Manifest 2 Chrome打包的应用本地根html链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 无法在应用程序内部显示任何本地网址时发生红色错误。打开同窗链接到chrome-extension://nmajpganl/options.html;尝试目标=_空白。 index.html:1 

有没有办法在本地链接权限?或者是否必须将所有内容都重写为一页?



我认为这与Chrome Manifest Sandbox有关......需要包含您要链接的所有页面?任何人都可以证实这一点吗?

解决方案

打包应用程序不是网站。应用程序和网站之间的主要区别在于没有导航。你有几个选择:


  1. 为你的选项创建一个窗口,就像你为主窗口做的那样。


  2. 使用< webview> ;.这是非常不可能的(假设选项意味着像首页一样),这是你想要的。但是你可以这样做。

  3. 正如错误消息所示,使用target = _blank并找出正常Chrome选项卡打开它的方式(例如,在网站上托管它)。对于您的应用程序,这种方法将是疯狂的。


I'm getting a red error when I click on any local url inside the app it says.

Can't open same-window link to "chrome-extension://nmajpganl/options.html"; try target="_blank". index.html:1

Is there a way to link locally with permissions? Or do I have to rewrite everything to be on one page?

I think this is related to the Chrome Manifest Sandbox .. needing to include all the pages you will link to? Can anyone confirm this?

解决方案

Packaged apps aren't websites. A principal difference between apps and websites is there's no navigation. You have a few options:

  1. Create a window for your options the same way you did for your main window.

  2. As you say, rewrite the app to manipulate the main window's DOM rather than "replacing the DOM with that of a new location" (a fancy way to say navigation).

  3. Use <webview>. It's very unlikely (assuming options means something like a prefs page) that this is what you want. But you could do it.

  4. As the error message says, use target=_blank and figure out a way for a normal Chrome tab to open it (e.g., host it on a website). For your application, this approach would be insanity.

这篇关于通过Sandbox Manifest 2 Chrome打包的应用本地根html链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 02:31