Refused to execute script from URL because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled

Michael Wilson

I am trying to retrieve contacts from Google within an Angular 4 Universal app.

But I receive this error message once authentication has been done:

Refused to execute script from https://www.google.com/m8/feeds/contacts/default/full?access_token=TOKEN&alt=json because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.

At the moment everything is held in one Component:

import { Component, OnInit } from '@angular/core';
import { Jsonp } from '@angular/http';

@Component({
  selector: 'refer-friend',
  templateUrl: './referFriend.component.html',
})
export class ContactsComponent implements OnInit {
  constructor(private jsonp: Jsonp) { }
  ngOnInit(): void {
    this.auth();
  }
  auth() {
    gapi.auth.authorize({
      'client_id': 'CLIENTID.apps.googleusercontent.com',
      'scope': 'https://www.google.com/m8/feeds'
    }, () => {
      this.fetch(gapi.auth.getToken());  
    });
  }
  fetch(token: any) {
    this.jsonp.get('https://www.google.com/m8/feeds/contacts/default/full?access_token=' + token.access_token + '&alt=json')
     .map(data => {
        return data;
     })
     .subscribe(data => {
         console.log(data);
     });
  }
}

I got the code from this sample which works fine without this error happening. So I can only guess Angular is effecting something....

nickrak

The Google Contacts API documentation has a link to how the alt tag works. The value 'json' does not indicate that it will return JSONP data. Google returns that MIME type because the data it will give you is not executable.

https://developers.google.com/gdata/docs/2.0/reference

Try using the @angular/http standard get method instead of Jsonp.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Refused to execute script from because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled

From Dev

Refused to execute script from '*' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled

From Dev

Refused to execute script from 'file_name.php' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled

From Dev

Refused to execute script because strict MIME type checking is enabled

From Dev

Error on minification in console "Refused to execute because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled"

From Dev

Refused to apply style from 'URL' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled

From Dev

Refused to apply style from '' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled

From Dev

Refused to apply style from [Link] because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled

From Dev

"Refused to apply style from because its MIME type "('font/woff2')" is not a supported stylesheet MIME type, and strict MIME checking is enabled"

From Javascript

Refused to execute script, strict MIME type checking is enabled?

From Dev

Refused to execute script from 'url' because its MIME type ('image/jpeg') is not executable

From Dev

Refused to execute script from '..../angular.min.js' because its MIME type ('application/octet_stream') is not executable, and strict MIME type check

From Dev

Refused to apply style because its MIME type "text/html" is not supported stylesheet MIME type, and strict MIME checking is enabled

From Dev

(Node Express)Refused to apply style because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled

From Dev

Refused to apply style from... because its MIME type ('text/html') is not a supported style-sheet MIME type, and strict MIME checking is enabled

From Dev

Chrome and Spring security: Refused to execute script from 'http://<server url>/assets/app.js' because its MIME type ('') is not executable

From Dev

Refused to execute script from '*.ts' because its MIME type ('video/vnd.dlna.mpeg-tts') is not executable

From Dev

MIME type ('application/json') is not executable, and strict MIME type checking is enabled

From Dev

Webpack dev server throws error - Refused to execute script because its MIME type ('text/html') is not executable

From Dev

Importing jQuery plugin into Angular 2+ Refused to execute script because its MIME type ('text/html') is not executable

From Dev

Rewrite requests from loopback to angular2 (Refused to execute script because its MIME type ('text/html') is not executable)

From Dev

Tensorboard is showing a blank page (Refused to execute script from 'http://localhost:6006/index.js' because its MIME type)

From Dev

Refused to execute *path_to_bundle* as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type

From Dev

Refused to apply style because its MIME type ('text/html') is not a supported stylesheet MIME type

From Dev

The script from <url> was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type

From Dev

Refused to apply style from 'http://localhost:3000/style.css' because its MIME type ('text/html')

From Dev

Node refused to apply style because its MIME type ('text/html') is not a supported stylesheet MIME

From Javascript

Disable Chrome strict MIME type checking

From Dev

Refused to display style because MIME type

Related Related

  1. 1

    Refused to execute script from because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled

  2. 2

    Refused to execute script from '*' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled

  3. 3

    Refused to execute script from 'file_name.php' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled

  4. 4

    Refused to execute script because strict MIME type checking is enabled

  5. 5

    Error on minification in console "Refused to execute because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled"

  6. 6

    Refused to apply style from 'URL' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled

  7. 7

    Refused to apply style from '' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled

  8. 8

    Refused to apply style from [Link] because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled

  9. 9

    "Refused to apply style from because its MIME type "('font/woff2')" is not a supported stylesheet MIME type, and strict MIME checking is enabled"

  10. 10

    Refused to execute script, strict MIME type checking is enabled?

  11. 11

    Refused to execute script from 'url' because its MIME type ('image/jpeg') is not executable

  12. 12

    Refused to execute script from '..../angular.min.js' because its MIME type ('application/octet_stream') is not executable, and strict MIME type check

  13. 13

    Refused to apply style because its MIME type "text/html" is not supported stylesheet MIME type, and strict MIME checking is enabled

  14. 14

    (Node Express)Refused to apply style because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled

  15. 15

    Refused to apply style from... because its MIME type ('text/html') is not a supported style-sheet MIME type, and strict MIME checking is enabled

  16. 16

    Chrome and Spring security: Refused to execute script from 'http://<server url>/assets/app.js' because its MIME type ('') is not executable

  17. 17

    Refused to execute script from '*.ts' because its MIME type ('video/vnd.dlna.mpeg-tts') is not executable

  18. 18

    MIME type ('application/json') is not executable, and strict MIME type checking is enabled

  19. 19

    Webpack dev server throws error - Refused to execute script because its MIME type ('text/html') is not executable

  20. 20

    Importing jQuery plugin into Angular 2+ Refused to execute script because its MIME type ('text/html') is not executable

  21. 21

    Rewrite requests from loopback to angular2 (Refused to execute script because its MIME type ('text/html') is not executable)

  22. 22

    Tensorboard is showing a blank page (Refused to execute script from 'http://localhost:6006/index.js' because its MIME type)

  23. 23

    Refused to execute *path_to_bundle* as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type

  24. 24

    Refused to apply style because its MIME type ('text/html') is not a supported stylesheet MIME type

  25. 25

    The script from <url> was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type

  26. 26

    Refused to apply style from 'http://localhost:3000/style.css' because its MIME type ('text/html')

  27. 27

    Node refused to apply style because its MIME type ('text/html') is not a supported stylesheet MIME

  28. 28

    Disable Chrome strict MIME type checking

  29. 29

    Refused to display style because MIME type

HotTag

Archive