< >

cors-umgehen.php


Quell Code


<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<div id="top">
 <label>
 sdvfgbhhfg
    <input type="url" id="url" value="">
  </label>
  <label>
    If using POST, enter the data:
    <input type="text" id="data">
  </label>
  <label>
    <button id="get">GET</button><button id="post">POST</button>
  </label>
</div>
<div id="bottom">
  <textarea id="output"></textarea>
</div>
<script>
 
  var  url ="https://plugins.jquery.com/tag/ui/page/2/";
(function() {
    var cors_api_host = 'cors-anywhere.herokuapp.com';
    var cors_api_url = 'https://' + cors_api_host + '/';
    var slice = [].slice;
    var origin = window.location.protocol + '//' + window.location.host;
    var open = XMLHttpRequest.prototype.open;
    XMLHttpRequest.prototype.open = function() {
        var args = slice.call(arguments);
        var targetOrigin = /^https?:\/\/([^\/]+)/i.exec(args[1]);
        if (targetOrigin && targetOrigin[0].toLowerCase() !== origin &&
            targetOrigin[1] !== cors_api_host) {
            args[1] = cors_api_url + args[1];
        }
        return open.apply(this, args);
    };
    
    $.ajax({
  url: url,
  cache: false
})
  .done(function( html ) {
    $( "body" ).html( html );
  });
    
    
    
    
    
})();
</script>