Widgets.js served from filesystem


Until recently (today?), we haven’t had any issues using widgets.js in a webview that loads it’s root document from the file system… Recently, something changed and the library is now attempting to load the following resource within the webview:


seems that whatever attempts to load //platform.twitter.com/widgets/twitter_cookies.html?namespace=twttr%3Acookies&origin=file%3A%2F%2F is assuming that the root document was loaded from a web server, and assuming that a protocol-relative URL will always resolve to either an http or https scheme. of course, because that file doesn’t exist on the user’s device, the request fails and the result in our case is the webview process exits unexpectedly.

this seems to be specific to webviews… e.g., if i save this sample HTML document to my local file system, then load that document from the file system in a standard browser (e.g., Safari or Chrome), the twitter_cookies.html request is never made.

this issue is affecting our users in production. our short term solution is to disable loading of widgets.js, but we’d of course prefer that our users have a consistent experience when viewing an embedded tweet.


@sankalp_sans fyi this is the same issue that you’re seeing


Duplicate of this thread, so I’m going to close this in favour of the original one.