小编Atu*_*rma的帖子

禁用Chrome严格MIME类型检查

有没有办法strict MIME type checking在Chrome中禁用.

实际上我正在跨域提出JSONP请求.它在Firefox上运行良好但是,使用chrome时它在控制台中给出了一些错误.

拒绝从' https://example.com ' 执行脚本,因为其MIME类型('text/plain')不可执行,并且启用了严格的MIME类型检查.

它在Mozilla中完美运行.问题仅出现在chrome中

以下是请求的响应标题..

Cache-Control:no-cache, no-store
Connection:Keep-Alive
Content-Length:29303
Content-Type:text/plain;charset=ISO-8859-1
Date: xxxx
Expires:-1
Keep-Alive:timeout=5
max-age:Thu, 01 Jan 1970 00:00:00 GMT
pragma:no-cache
Set-Cookie:xxxx
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options:nosniff
X-Frame-Options:SAMEORIGIN
Run Code Online (Sandbox Code Playgroud)

解决方法我认为:外部设置内容类型为application/javascript

javascript jquery google-chrome angularjs

43
推荐指数
4
解决办法
14万
查看次数

包含`声明模块'graphql/error/GraphQLError'的声明(.d.ts)文件;在 angular 项目的 index.d.ts 中

我在一个角度项目中使用放大。当我运行命令 ng serve 时出现此错误。

Error: node_modules/@aws-amplify/api-graphql/lib-esm/types/index.d.ts:1:30 - error TS7016: Could not find a declaration file for module 'graphql/error/GraphQLError'. 'C:/Users/Ruwani Indrachapa/Documents/profileApp/profileApp1/node_modules/graphql/error/GraphQLError.js' implicitly has an 'any' type.
 Try `npm install @types/graphql` if it exists or add a new declaration (.d.ts) file containing `declare module 'graphql/error/GraphQLError';`

1 import { GraphQLError } from 'graphql/error/GraphQLError';
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@aws-amplify/api-graphql/lib-esm/types/index.d.ts:2:30 - error TS7016: Could not find a declaration file for module 'graphql/language/ast'. 'C:/Users/Ruwani Indrachapa/Documents/profileApp/profileApp1/node_modules/graphql/language/ast.js' implicitly has an 'any' type.
 Try `npm install @types/graphql` if it exists or add …
Run Code Online (Sandbox Code Playgroud)

javascript graphql angular aws-amplify

15
推荐指数
3
解决办法
3253
查看次数

为什么像`toString`这样的方法在数字后需要两个点?

什么是背后的逻辑42..toString()..

双点工作并返回字符串"42",而42.toString()单个点失败.

同样,42...toString()三个点也失败了.

谁能解释这种行为?

console.log(42..toString());
Run Code Online (Sandbox Code Playgroud)

console.log(42.toString());
Run Code Online (Sandbox Code Playgroud)

javascript

9
推荐指数
1
解决办法
553
查看次数

通过 USB 安装应用程序 [安装被用户取消]

我可以通过 USB 将应用程序安装到我的 Android 设备上。

但是,当 Android 上显示允许/拒绝安装弹出窗口时,我错误地单击了“拒绝”,并选中了“记住我的选择”。

现在,每次尝试通过 USB (ADB) 安装应用程序都失败并出现错误com.android.ddmlib.InstallException: Failed to finalize session : INSTALL_FAILED _USER_RESTRICTED: Install canceled by user

在此输入图像描述

我单击“拒绝”并选中“记住”选项。现在所有安装都失败。

我重新启动了我的设备,启用了禁用开发人员选项但是,没有工作:(

如何重置我的选择?

android adb

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

填充 svg 路径背景。填充不起作用

我需要在 SVG 中创建一个对话气泡。

无法填充 svg 路径的背景。我需要为这条路径填充背景颜色。填充只是像描边一样为边框着色。

<svg>
  <g xmlns="http://www.w3.org/2000/svg" transform="matrix(1,0,0,1,1,1)" id="g3">
    <path fill="red" d="M 45.673,0 C 67.781,0 85.703,12.475 85.703,27.862 C 85.703,43.249 67.781,55.724 45.673,55.724 C 38.742,55.724 32.224,54.497 26.539,52.34 C 15.319,56.564 0,64.542 0,64.542 C 0,64.542 9.989,58.887 14.107,52.021 C 15.159,50.266 15.775,48.426 16.128,46.659 C 9.618,41.704 5.643,35.106 5.643,27.862 C 5.643,12.475 23.565,0 45.673,0 M 45.673,2.22 C 24.824,2.22 7.862,13.723 7.862,27.863 C 7.862,34.129 11.275,40.177 17.472,44.893 L 18.576,45.734 L 18.305,47.094 C 17.86,49.324 17.088,51.366 16.011,53.163 C 15.67,53.73 15.294,54.29 14.891,54.837 C 18.516,53.191 22.312,51.561 25.757,50.264 L 26.542,49.968 L 27.327,50.266 C 32.911,52.385 39.255,53.505 …
Run Code Online (Sandbox Code Playgroud)

html css svg stroke jquery-svg

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

在页面之间导航时显示加载程序 - PWA

我有一个基于PHP的网站.

我已经使用service-workers,并manifest.json在网站转换成PWA.

现在,当我从主屏幕启动PWA时,它通常像APP一样工作.但是,问题在于,由于PWA不显示浏览器地址栏,因此用户无法知道正在重新加载页面或正在加载下一页.当他们点击某些内容时,下一页被加载但没有显示加载指示符.

所以,现在我需要在页面之间导航时添加加载动画.由于所有页面都在不同的URL,并且它们不是主框架.

我无法找到解决方案.

javascript php service-worker progressive-web-apps

5
推荐指数
1
解决办法
1715
查看次数

在 ng-bind Angular Js 中使用 ng-if

<span ng-repeat="tag in tags">
   {{tag + "," }}
</span>
Run Code Online (Sandbox Code Playgroud)

我需要,在最后一个元素之后删除。我知道ng-if="$last"可以解决问题。但是,由于我没有任何父元素,{{tag}}因此无法使用ng-if,只需要解决一些问题。

javascript arrays jquery angularjs

4
推荐指数
1
解决办法
1720
查看次数

SSH 错误 10054,Flow Socket 接收字节时出错

通过 SSH 连接到服务器时.. 连接已建立,但 1-2 秒后断开连接并给出错误消息。

尝试过 Bitvise SSH 客户端、WinSCP。同样的问题。

错误"Flow Socket Error receiving Bytes. Windows error 10054, An existing connection was forcibly closed by remote host."

什么也做不了。几乎尝试了我发现的一切。

Ubuntu 服务器、数字海洋

sockets ssh digital-ocean

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

NodeJs 发送带有请求的二进制数据

我正在尝试使用 Wordpress rest API 将图像上传到 wordpress。

一切正常,但是没有上传正确的图像。但是,当我使用 Curl 图像时是正确的。

curl --request POST \
--url http://localhost/wordpress/wp-json/wp/v2/media/ \
--header "cache-control: no-cache" \
--header "content-disposition: attachment; filename=hh.jpg" \
--header "authorization: Basic token" \
--header "content-type: image/jpg" \
--data-binary "@C://Users/as/Desktop/App _Ideas/hh.jpg" \
Run Code Online (Sandbox Code Playgroud)

此卷曲请求工作正常。

现在,当我将请求转换为 Nodejs 时

request({
        url: ' http://localhost/wordpress/wp-json/wp/v2/media/',
        headers: {
          'cache-control': 'no-cache',
          'content-disposition': 'attachment; filename='+filename,
          'content-type' : 'image/jpg',
          'authorization' : 'Basic token'
        },
        encoding: null,
        method: 'POST',
        body: "@C://Users/as/Desktop/App _Ideas/hh.jpg",
        encoding: null
       }, (error, response, body) => {
            if (error) {
               res.json({name …
Run Code Online (Sandbox Code Playgroud)

node.js

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

图像到bootstrap中div的中心

无论大小如何,所有图像都应居中对齐.我试过下面的代码,但它对我不起作用.任何帮助,将不胜感激

.border-class{
  border:1px solid #ddd;
  padding:5px;
  min-height:160px;
}
Run Code Online (Sandbox Code Playgroud)
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container">
 <div class="col-xs-3"> 
   <div class="border-class">
  <img src="http://www.w3schools.com/bootstrap/cinqueterre.jpg" class="img-responsive" alt="Cinque Terre"/> 
     </div>
</div>
<div class="col-xs-3">   
  <div class="border-class">
  <img src="https://cdn2.iconfinder.com/data/icons/hawcons-gesture-stroke/32/icon_27_one_finger_click-128.png" class="img-responsive" alt="Cinque Terre"/> 
    </div>
</div>
<div class="col-xs-3">   
  <div class="border-class">
  <img src="http://www.w3schools.com/bootstrap/cinqueterre.jpg" class="img-responsive" alt="Cinque Terre"/> 
    </div>
</div>
<div class="col-xs-3"> 
  <div class="border-class">
  <img src="http://www.w3schools.com/images/colorpicker.png" class="img-responsive" alt="Cinque Terre"/> 
    </div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)

css twitter-bootstrap

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

CSS类以错误的顺序应用

我有一个单独使用时正常工作的代码.

<div class="red green blue"> </div> 
Run Code Online (Sandbox Code Playgroud)

现在red首先应用属性green然后通过覆盖blue.最后,divblue.

但是,当我通过引用HTML文件在主应用程序中加载相同的内容时angular include,CSS的顺序被颠倒了.

现在blue得到应用首先覆盖green然后red.现在divred

这打破了代码逻辑.

如果有人有想法,可能的原因是什么?

html javascript css angularjs

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

ng-class不在简单示例中评估表达式

此代码在ng-repeat循环中.表达式不是在浏览器内部进行评估,整个语句也是在浏览器中.

 <i ng-class="'icon-ok' : student.is_passed == 'passed', 'icon-remove': student.is_passed == 'failed'"></i>
Run Code Online (Sandbox Code Playgroud)

angularjs ng-class

0
推荐指数
1
解决办法
994
查看次数

SQL如何选择前3个日期

我有以下表结构..

id    title   Date
1     Abc     14 Nov 2016
2     Abc     14 Nov 2016
3     Abc     13 Nov 2016
4     Abc     13 Nov 2016
5     Abc     13 Nov 2016
6     Abc     12 Nov 2016
7     Abc     12 Nov 2016
8     Abc     11 Nov 2016
9     Abc     11 Nov 2016
Run Code Online (Sandbox Code Playgroud)

如何仅选择前 3 个日期的数据... 意味着列的数据的日期为14,13, 12.

或可能是接下来的 3 个日期.. 就像仅13,12,11或仅的数据12,11

不知道如何制作它..使用MYSQL

mysql sql

0
推荐指数
1
解决办法
3688
查看次数