This is a (multiple allowed):
Swiper doesn't work in IE11 since 5.3.0. The browser shows a problem with "startsWith" method (or property).
To resolve an error we can use next polyfill:
if (!String.prototype.startsWith) {
String.prototype.startsWith = function (searchString, position) {
position = position || 0;
return this.indexOf(searchString, position) === position;
};
}
IE 11 is not supported by v5
Thanks! It helped me
@Gachegov59 @nolimits4web is the library still not supported in V5+?
Just for the record, we're compiling TypeScript with webpack and we have a loader.js with the following:
// Typescript loader
const ts = {
test: /\.(tsx?|jsx?)$/,
exclude: [
/node_modules\/(?!(swiper|ssr-window|dom7)\/).*/,
/.out/,
/.storybook/,
],
use: [
{
loader: 'babel-loader',
options: {
configFile: `${__dirname}/babel.config.json`,
},
},
],
};
This now transpiles the swiper, ssr-window and dom7 modules and swiper is now working in IE11, with the polyfills working too.
We're using the following versions:
"swiper": "^5.4.2",
"babel-loader": "^8.0.6",
"webpack": "^4.42.1",
Note: it took me a while to notice that the 'test' line needed to include .js files as well as .ts files now that we are including certain node_modules, as the rest of our code is .ts files.
test: /\.(tsx?|jsx?)$/,
Most helpful comment
Just for the record, we're compiling TypeScript with webpack and we have a loader.js with the following:
This now transpiles the swiper, ssr-window and dom7 modules and swiper is now working in IE11, with the polyfills working too.
We're using the following versions:
Note: it took me a while to notice that the 'test' line needed to include .js files as well as .ts files now that we are including certain node_modules, as the rest of our code is .ts files.