Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: XMLHttpRequest error. #34

Open
ryosuke-hujisawa opened this issue Aug 16, 2021 · 4 comments
Open

Error: XMLHttpRequest error. #34

ryosuke-hujisawa opened this issue Aug 16, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@ryosuke-hujisawa
Copy link

    var data = await MetadataFetch.extract(
      'https://flutter.dev'); // returns a Metadata object
          print(data); // Metadata.toString()
          print(data?.title); // Metadata.title
          print(data?.toMap()); // converts Metadata to map
          print(data?.toJson()); // converts Metadata to JSON

I tried to get the title tag of website in a web browser on my local host, but it failed. It also fails in the production environment because of this error. I'm sure the cross-domain error has something to do with it, but how can I get the meta tags in my web browser?

Error: XMLHttpRequest error.
    dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 909:28                get current
packages/http/src/browser_client.dart 71:22                                       <fn>
dart-sdk/lib/async/zone.dart 1613:54                                              runUnary
dart-sdk/lib/async/future_impl.dart 155:18                                        handleValue
dart-sdk/lib/async/future_impl.dart 707:44                                        handleValueCallback
dart-sdk/lib/async/future_impl.dart 736:13                                        _propagateToListeners
dart-sdk/lib/async/future_impl.dart 533:7                                         [_complete]
dart-sdk/lib/async/stream_pipe.dart 61:11                                         _cancelAndValue
dart-sdk/lib/async/stream.dart 1219:7                                             <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 324:14  _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 329:39  dcall
dart-sdk/lib/html/dart2js/html_dart2js.dart 37307:58                              <fn>


    at Object.createErrorWithStack (http://localhost:7357/dart_sdk.js:5054:12)
    at Object._rethrow (http://localhost:7357/dart_sdk.js:37670:16)
    at async._AsyncCallbackEntry.new.callback (http://localhost:7357/dart_sdk.js:37666:13)
    at Object._microtaskLoop (http://localhost:7357/dart_sdk.js:37526:13)
    at _startMicrotaskLoop (http://localhost:7357/dart_sdk.js:37532:13)
    at http://localhost:7357/dart_sdk.js:33303:9
@jg-l
Copy link
Owner

jg-l commented Aug 21, 2021

investigation.

can i see the code that calls extract()?

@jg-l jg-l added the bug Something isn't working label Aug 21, 2021
@mirrorlink
Copy link

MetadataFetch.extract(''https://pub.dev');

will give the error. Im having the same issue, its on flutter web

@mirrorlink
Copy link

use
https://stackoverflow.com/questions/65630743/how-to-solve-flutter-web-api-cors-error-only-with-dart-code

to test on localhost

@kekko7072
Copy link

@mirrorlink any solution for production?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants