1
votes

I'm getting error as "Refused to execute script from 'URL' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled."

My code is as below.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $.ajax({
                url: "https://www.google.com/finance/converter?a=1&from=INR&to=USD&jsoncallback=?",
                type: "GET",
                contentType: "application/javascript",                   
                cache: false,
                dataType: "jsonp",
                success : function(response){
                        alert("Hi");
                }
            });            
    });

    </script>
</head>
<body>
</body>
</html>
1
This error message says it all. It’s a server side problem. mime type is sent in response header. Nothing you can do if you’re not owner of that API.hackape

1 Answers

0
votes

The URL you have provided (https://www.google.com/finance/converter?a=1&from=INR&to=USD&jsoncallback=?) seems to point to a HTML page. The error is very much self explanatory. I hear that google currency converter is no longer online. Please try some other API may be like JsonRates