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

Justice taylor

I am trying to fetch book cover,title and author using openlibrary.org api. But i can't do it.When i click the search this image appears as shown in screenshot.Also i am providing some source code.And i am getting error "Refused to execute script from 'http://ia800609.us.archive.org/view_archive.php?archive=/28/items/olcovers121/olcovers121-M.zip&file=1212744-M.jpg&ext=' because its MIME type ('image/jpeg') is not executable." Please provide some suggetion regarding solving the error.Thanks in advance.

function search_google_books() {
  var script = document.createElement('script');

  var isbn = document.forms[0].isbn;

  if (isbn && isbn.value != '') {
    document.getElementById('thumbnail').innerHTML = '<img src="./loading.gif" />';
    script.src = 'http://covers.openlibrary.org/b/isbn/' + isbn.value + '-M.jpg';


    document.body.appendChild(script);
  } else {
    alert('Please input ISBN!');
  }
}

function show_bookcover(booksInfo) {
  var link = '<span class="nolink">No image available...</span>';
  for (i in booksInfo.items) {
    var book = booksInfo.items[i]
    var image = book.volumeInfo.imageLinks;
    if (image && image.thumbnail != undefined) {
      var thumbnail = image.thumbnail.replace('zoom=5', 'zoom=1');
      if (document.location.protocol == 'https:') {
        var parser = document.createElement('a');
        parser.href = thumbnail;
        parser.protocol = 'https:';
        parser.hostname = 'encrypted.google.com';
        thumbnail = parser.href;
      }
      link = '<img src="' + thumbnail + '" />';
      if (book.accessInfo && book.accessInfo.viewability != "NO_PAGES") {
        var preview = book.volumeInfo.previewLink;
        link += '<br />';
      }
    }
    link += '<br />Title: ' + book.volumeInfo.title;
    if (book.volumeInfo.authors.length > 0) {
      link += '<br />Author: ' + book.volumeInfo.authors.join("; ");
    }
  }
  document.getElementById('thumbnail').innerHTML = link;
} <
#thumbnail {
  margin: 1em 4em;
}
<html>

<head>
  <title>Test for Open Search API: book cover</title>
</head>

<body>
  <div id="form">
    <form>
      Enter ISBN: <input type="text" size="40" placeholder="ISBN" value="9780415261876" name="isbn" id="isbn" />
      <button onclick="javascript:search_google_books();
            return false;">Search</button>
    </form>
  </div>
  <div id="thumbnail"></div>
</body>

Christiaan Nieuwlaat

When you just want to fetch the associated book cover image, a few minor modifications in your code would be enough:

function search_google_books() {
  var isbn = document.forms[0].isbn;

  if (isbn && isbn.value != '') {
    document.getElementById('thumbnail').innerHTML = '<img src="http://covers.openlibrary.org/b/isbn/' + isbn.value + '-M.jpg" />';

  } else {
    alert('Please input ISBN!');
  }
}
#thumbnail {
  margin: 1em 4em;
}
<html>

<head>
  <title>Test for Open Search API: book cover</title>
</head>

<body>
  <div id="form">
    <form>
      Enter ISBN: <input type="text" size="40" placeholder="ISBN" value="9780415261876" name="isbn" id="isbn" />
      <button onclick="javascript:search_google_books();
            return false;">Search</button>
    </form>
  </div>
  <div id="thumbnail"></div>
</body>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Refused to execute script because strict MIME type checking is enabled

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

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

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

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

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

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

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

Webpack + React.lazy + nested routing: Refused to apply style from '*/css/main.css' because its MIME type ('text/html')

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

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

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

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

(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

Refused to display style because MIME type