如何在Chrome扩展程序/应用程序中绘制到另一个.html页面? [英] How to ink to another .html page within Chrome extension/app?

查看:177
本文介绍了如何在Chrome扩展程序/应用程序中绘制到另一个.html页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为客户端构建一个chrome应用程序,该应用程序将以信息亭模式运行,以在其商店中显示.现在,我有一个index.html页面,该页面链接到大约30个其他页面.但是,当我单击应用程序中的链接时,出现错误...

I am building a chrome app for a client that will run in kiosk mode to display in their stores. Right now I have an index.html page that links to about 30 other pages. However, when I click on a link in the app I get an error...

Can't open same-window link to "chrome-extension://leghflngpfmomcflabikghiemaajadne/poweredge"; try target="_blank".

所以我尝试了target ="_ blank"并尝试在新的Chrome窗口中打开它.我已经阅读了一些有关使用Webview和沙箱页面的信息,但是它们都在一个新窗口中打开了页面,但是看起来并不好.

So I tried target="_blank" and that tries to open it in a new chrome window.. no good. I've been reading a little bit about using webview and sandboxing pages but they both open the pages in a new window and it just doesn't look good.

是否有更好的方法可以做到这一点?现在,我唯一的想法是将所有内容放在index.html页面上,并使用jQuery打开/关闭内容部分.不过,我还是想将所有页面分开,只是为了我自己的理智.

Is there a better way to do this? Right now my only idea is to place all of the content on the index.html page and turn on/off sections of the content with jQuery. I'd love to keep all of the pages separate though, just for my own sanity.

谢谢!

推荐答案

导航已禁用 Chrome Apps平台.从理论上讲,您应该制作单页应用程序-因此您的打开/关闭方法是预期的"应用程序.

Navigation is disabled for the Chrome Apps platform. In theory you are supposed to make single-page apps - so your turn on/off approach is the "intended" one.

没有人会阻止您拥有多个窗口-假设您有一个选项页面,单独打开(通过chrome.app.window.create)并不奇怪

No-one stops you from having several windows though - suppose you have an options page, it wouldn't be strange to open it separately (via chrome.app.window.create)

如stdob在评论中所述,可以通过将<webview>与分区有幸展示本地资源.尚不清楚是否是否将允许访问应用程序API.

As stdob mentions in comments, a workaround may be possible by using <webview> with a partition blessed to show local resources. It's not clear though if it will allow access to apps APIs.

这篇关于如何在Chrome扩展程序/应用程序中绘制到另一个.html页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆