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

unable to fetch citation response in ie 11 #180

Open
vivek1395068 opened this issue May 13, 2019 · 8 comments
Open

unable to fetch citation response in ie 11 #180

vivek1395068 opened this issue May 13, 2019 · 8 comments
Labels

Comments

@vivek1395068
Copy link

vivek1395068 commented May 13, 2019

The following error i am getting in the browser console:-
"SCRIPT8: The download of the specified resource has failed."

while it works fine in mozilla and chrome browsers with the following warning in the console:-
"Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help http://xhr.spec.whatwg.org/".

I tried debugging the library and found that there xhr have been used and also trying to make synchronous api call. So i think that is the issue with ie and edge, the synchronous api calls are getting deprecated.

So can anyone please update the library, and make an asynchronous call instead of synchronous one or find some another solution for that. It will be a great help. Thanks

@larsgw
Copy link
Owner

larsgw commented May 13, 2019

Thank you for your question. There is already an asynchronous API:

// Callback
Cite.async(input, function callback (/* <Cite> */ data) { ... })

// Promise
Cite.async(input) // Promise<Cite>, use with `.then()` or `await`

@vivek1395068
Copy link
Author

Thanks for the reply :). But still I am getting the same error in the console while i am using promise :-

// Promise
Cite.async(input)

in ie 11:-
error:-"The download of the specified resource has failed."

while the warning messages in chrome and mozilla browsers are gone.

Is this because we are using fetch api in the library?

@larsgw
Copy link
Owner

larsgw commented May 13, 2019

The polyfill that Citation.js uses should support IE 10+. Can you share the input you're having problems with?

@vivek1395068
Copy link
Author

vivek1395068 commented May 14, 2019

Please find the following code which i am using:-
var opt = {
format: "string",
type: "string",
style: "bibtxt",
lang: "en-US"
};
Cite.async("10.7717/peerj-cs.52").then((cite)=>{
var output = cite.get(opt);
console.log(output)
}).catch((error)=>{
console.log(error.message);
});

The above code is getting executed on click of a button .

in ie 11 console :-
error:-"The download of the specified resource has failed."
ie11_error

@larsgw
Copy link
Owner

larsgw commented May 14, 2019

The main difference between the Firefox & Chrome code and the IE11 code is the Fetch API polyfill, which isn't usually applied on Chrome & Firefox since they have it natively already. However, it seems to be working fine for me (both synchronously and asynchronously) when I test it in IE11 on Browserstack. I might be able to test on a real machine with IE11 in a few days, I'll report back if I find it out.

For the record, the error code apparently corresponds to INET_E_DOWNLOAD_FAILURE (0x800C0008), with the following description:

The download has failed (the connection was interrupted).

@vivek1395068
Copy link
Author

Sure Thanks.

@larsgw
Copy link
Owner

larsgw commented May 14, 2019

What version of Citation.js are you using?

@vivek1395068
Copy link
Author

vivek1395068 commented May 14, 2019

Actually I have included it in my index.html file like this :-

<script src="https://citation.js.org/src/citation.js"></script>

also one more thing, is this related to CORS issue because in network i am able to see that we are making a call to "https://data.crossref.org/10.7717/peerj-cs.52" api ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants