Skip to content

Conversation

@aleswita
Copy link

Correct regex for Safari detection

navigator.userAgent return
Mozilla/5.0 (Macintosh; Intel Max OS X 10_12_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15

@aleswita
Copy link
Author

@vojtech-dobes ping

@spernica
Copy link

spernica commented Sep 3, 2018

Prosím, nemůžete použít let ... of, protože není pořádně podporovaný - https://www.w3schools.com/js/js_let.asp

Úplně mi váš skript odstřelil javascript v IE <=11

Konkrétně řádek (hlásí Byl očekáván znak ';')
for (var pair of formData.entries()) {

Správně je podle mě:

		if (formData.entries && navigator.userAgent.match(/version\/11(\.[0-9]+)* safari/i)) {
			var entries = formData.entries();
			for (var i = 0; i < entries.length; i++) {
				var pair = entries[i];
				if (pair[1] instanceof File && pair[1].name === '' && pair[1].size === 0) {
					formData.delete(pair[0]);
				}
			}
		}

Ale nemám otestované safari. Pouze IE a chrome.

@Bezdekm
Copy link

Bezdekm commented Nov 7, 2018

@spernica some problem

@lukasojd
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants