首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >拒绝加载脚本“architect://architect.js t.js”

拒绝加载脚本“architect://architect.js t.js”
EN

Stack Overflow用户
提问于 2019-01-03 11:31:02
回答 1查看 285关注 0票数 0

这里的解决方案似乎有一个坏链接,所以我发布了另一个链接。

无法加载我的世界,无法加载架构师://architect.‘t

你好,我在努力学习如何加载

architect.js

在我的cordova android项目中,使用插件,因为这个插件不断显示

拒绝加载脚本‘architect://architect t.js’,因为它违反了以下内容安全策略指令:" script -src *‘不安全-内联’‘不安全-eval’“。请注意,“script-src-elem”没有显式设置,因此“script-src”用作回退。

下面是关于如何添加architect.js的文档

https://www.wikitude.com/external/doc/documentation/latest/phonegap/samples.html#including-architectjs-prior-to-wikitude-sdk-53

这是我的密码

index.html

代码语言:javascript
复制
<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * 'unsafe-inline';">
    <meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highlight" content="no">
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
    <link rel="stylesheet" type="text/css" href="css/index.css">
    <script src="architect://architect.js"></script>
    <title>Hello World</title>
</head>
<body>
    <button onclick="app.fight()" style="width:30%;height:30%;font-size: 30px; margin-top: 40%; margin-left: 30%">Camera</button>

    <textarea id="fem"></textarea>
    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
</body>

index.js

代码语言:javascript
复制
var app = {

// Url/Path to the augmented reality experience you would like to load
arExperienceUrl: "www/index.html",
// The features your augmented reality experience requires, only define the ones you really need
requiredFeatures: [ "image_tracking"],
// Represents the device capability of launching augmented reality experiences with specific features
isDeviceSupported: false,
// Additional startup settings, for now the only setting available is camera_position (back|front)
startupConfiguration:
{
    "camera_position": "back"
},
// Application Constructor
initialize: function() {
    this.bindEvents();
},
// Bind Event Listeners
//
// Bind any events that are required on startup. Common events are:
// 'load', 'deviceready', 'offline', and 'online'.
bindEvents: function() {
    document.addEventListener('deviceready', this.onDeviceReady, false);
},
// deviceready Event Handler
onDeviceReady: function() {
    app.wikitudePlugin = cordova.require("com.wikitude.phonegap.WikitudePlugin.WikitudePlugin");
    app.wikitudePlugin.isDeviceSupported(app.onDeviceSupported, app.onDeviceNotSupported, app.requiredFeatures);
},
// Callback if the device supports all required features
onDeviceSupported: function() {

    app.wikitudePlugin.loadARchitectWorld(
        app.onARExperienceLoadedSuccessful,
        app.onARExperienceLoadError,
        app.arExperienceUrl,
        app.requiredFeatures,
        app.startupConfiguration
    );
},
// Callback if the device does not support all required features
onDeviceNotSupported: function(errorMessage) {
  alert("Device not supported"+ errorMessage);
},
// Callback if your AR experience loaded successful
onARExperienceLoadedSuccessful: function(loadedURL) {
    /* Respond to successful augmented reality experience loading if you need to */
    alert(AR);
},
// Callback if your AR experience did not load successful
onARExperienceLoadError: function(errorMessage) {
    alert(errorMessage);
}
};

app.initialize();
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-04 07:14:26

如果您正在使用高于5.3的任何版本的Wikitude,则必须使用

代码语言:javascript
复制
<script src="https://www.wikitude.com/libs/architect.js"></script>

正如文档中所描述的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54021446

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档