javascript - jQuery .get for non https, in a userscript - Stack Overflow
I made a script on my website that accesses a table on a different website. However, the other website is HTTP so chrome is telling me "This request has been blocked; the content must be served over HTTPS."
$.get('', null, function searchKD () { /*function*/ });
So what I'm asking is: how can I access elements on a different website even if it's not HTTPS.
I made a script on my website that accesses a table on a different website. However, the other website is HTTP so chrome is telling me "This request has been blocked; the content must be served over HTTPS."
$.get('http://www.kanjidamage./kanji', null, function searchKD () { /*function*/ });
So what I'm asking is: how can I access elements on a different website even if it's not HTTPS.
Share Improve this question edited Jun 19, 2017 at 1:35 Brock Adams 93.7k23 gold badges241 silver badges305 bronze badges asked Jun 19, 2017 at 0:44 user5287133user52871334 Answers
Reset to default 6You have this tagged as tampermonkey. If that is the case, use it.
Tampermonkey allows one to bypass "mixed active content" restrictions by using GM_xmlhttpRequestDoc.
So this plete Greasemonkey/Tampermonkey script works fine:
// ==UserScript==
// @name _Mixed content AJAX
// @match https://stackoverflow./questions/44620859/*
// @require http://ajax.googleapis./ajax/libs/jquery/2.1.0/jquery.min.js
// @grant GM_xmlhttpRequest
// @connect kanjidamage.
// ==/UserScript==
GM_xmlhttpRequest ( {
method: "GET",
url: "http://www.kanjidamage./kanji",
onload: function (response) {
console.log (response.responseText);
}
} );
You either need to build a proxy, something server side that will get the remote content, and return it, or connect over https.
In PHP (For example), you could create a simple "kanji.php":
<?php
echo file_get_contents('http://www.kanjidamage./kanji');
?>
My suggestion:
Just download the page, strip the content you don't need (Like the header/footer), and then serve it locally. It seems like a simple enough page.
Yeah, both sites must use https, or else it defeats the purpose. Some content is encrypted & some is not. You could potentially send information that should be secured like a credit card number to an unsecured source.
If you have access to your server code. You can make a route that makes the request to the unsecured http domain. This way all your frontend requests point to the same domain, and the browser is happy as all requests are https.
you can try this :
$.get('//www.kanjidamage./kanji', null, function searchKD () { /*function*/ });
- 已故打车软件的反思 :我们为何被滴滴打败
- 《福布斯》:缺乏硬软件支持 NFC已成鸡肋
- 后PC时代是五足鼎立还是苹果独领风骚?
- visual studio code - Azure Functions HTTPTrigger running locally with VSCode weird bug but API still works .NET - Stack Overflow
- google tag manager - GTM custom template - not able to trigger callback from script - Stack Overflow
- java - mac update sequoia 15.1 or 15.2 not work UniversalJavaApplicationStub - Stack Overflow
- typescript - How to fix GitHub building "unknown token" error in yarn.lock for GitHub Pages? - Stack Overflow
- python - Unet isn't working orand i'm not using it correctly - Stack Overflow
- c# - Querying CosmosDB_SQL from ASP.NET Core 8 Web API to return Single value - Stack Overflow
- Keeping Data In Denormalized NoSql Databases (CassandraScyllaDb) Tables In Sync? - Stack Overflow
- Symfony 7 - Autocomplete form field - Stack Overflow
- python - Four MLX90640 thermal cameras on 4 custom buses in Rasberry Pi 5B - Stack Overflow
- google apps script - How do I correct my code to move a row from one tab to another tab in Sheets, and then delete it from the s
- augmented reality - Applying 2d image to a 3d object in xcode tutorials? - Stack Overflow
- javascript - How to properly handle AES encryption in React Native and generate Random Key for AES encryption? - Stack Overflow
- python - Galaga game not running due to an empty range - Stack Overflow
- python - Airflow on_success_callback - Stack Overflow