Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Vivaldi decodeURIComponent ???

2 réponses
Avatar
Une B=c3=a9vue
Avec Vivaldi, contrairement à Safari et firefox, si j'ai :

window.location.href =

"http://mbp.local/Photo2Address/index.html?query={%22position%22:{%22lat%22:48.70436389,%22lng%22:2.23355,%22alt%22:72,%22dir%22:8.615617128},%22photo_url%22:%22http://mbp.local/Photos/Nikon_Transfer_2/2017/11/02/2017_11_02__07_35_12__IMG_3863.JPG%22,%22infos%22:{%22ImageWidth%22:4032,%22ImageHeight%22:3024,%22Orientation%22:%22Rotate%2090%20CW%22}}"

et que je décode puis prends la partie query de l'URL, j'obtiens, avec
Vivaldi :

"{%22position%22:{%22lat%22:48.70436389,%22lng%22:2.23355,%22alt%22:72,%22dir%22:8.615617128},%22photo_url%22:%22http://mbp.local/Photos/Nikon_Transfer_2/2017/11/02/2017_11_02__07_35_12__IMG_3863.JPG%22,%22infos%22:{%22ImageWidth%22:4032,%22ImageHeight%22:3024,%22Orientation%22:%22Rotate%2090%20CW%22}}"

comme c'esst du JSON, le parser n'accepte pas le %

par contre la même manip avec Safari, ou Firefox me donne :
decodeURIComponent(window.location.href).split('?query=')[1]
"{\"position\":{\"lat\":48.70436389,\"lng\":2.23355,\"alt\":72,\"dir\":8.615617128},\"photo_url\":\"http://mbp.local/Photos/Nikon_Transfer_2/2017/11/02/2017_11_02__07_35_12__IMG_3863.JPG\",\"infos\":{\"ImageWidth\":4032,\"ImageHeight\":3024,\"Orientation\":\"Rotate
90 CW\"}}"

le code JS invoqué :

if (window.location.href.indexOf('?query=') > 0) {
let query =
JSON.parse(decodeURIComponent(window.location.href).split('?query=')[1]);
for (let property in query) {
[...]

l'erreur que m'affiche la console Vivalsi :
Uncaught SyntaxError: Unexpected token % in JSON at position 1
at JSON.parse (<anonymous>)
at t.value (App.js:94)
at index.js:2114
at m.trigger (index.js:84)
at oe (index.js:1100)
at Object.<anonymous> (index.js:5)
at t (bootstrap 01c1ab1d286ee9c5968b:19)
at Object.<anonymous> (main.4f6f419a.js:300)
at t (bootstrap 01c1ab1d286ee9c5968b:19)
at bootstrap 01c1ab1d286ee9c5968b:62

2 réponses

Avatar
rm
Salut,
Le lundi 13 novembre 2017 à 16:12, Une Bévue a écrit :
Avec Vivaldi, contrairement à Safari et firefox, si j'ai :
window.location.href >
"http://mbp.local/Photo2Address/index.html?query={%22position%22:{%22lat%22:48.70436389,%22lng%22:2.23355,%22alt%22:72,%22dir%22:8.615617128},%22photo_url%22:%22http://mbp.local/Photos/Nikon_Transfer_2/2017/11/02/2017_11_02__07_35_12__IMG_3863.JPG%22,%22infos%22:{%22ImageWidth%22:4032,%22ImageHeight%22:3024,%22Orientation%22:%22Rotate%2090%20CW%22}}"
[...]
l'erreur que m'affiche la console Vivalsi :
Uncaught SyntaxError: Unexpected token % in JSON at position 1
at JSON.parse (<anonymous>)
at t.value (App.js:94)
at index.js:2114
at m.trigger (index.js:84)
at oe (index.js:1100)
at Object.<anonymous> (index.js:5)
at t (bootstrap 01c1ab1d286ee9c5968b:19)
at Object.<anonymous> (main.4f6f419a.js:300)
at t (bootstrap 01c1ab1d286ee9c5968b:19)
at bootstrap 01c1ab1d286ee9c5968b:62

C'est quoi la question ?
Ça pique les yeux pour un allergique au code comme moi, mais si tu penses
que c'est un bug de Vivaldi (surtout si tu ne reproduis pas ce comportement
avec les derniers Opera ou Chromium), tu peux le rapporter sur
https://vivaldi.com/bugreport/.
Cependant, j'opterais plutôt pour un comportement spécifique, voire un bug
du moteur de rendu Blink utilisé par Vivaldi, auquel cas faudra remonter le
bug ou chercher du support coté Chromium project :
https://bugs.chromium.org/p/chromium/issues/list
Bon courage,
--
rm - http://vivaldi-fr.com
Avatar
Une B=c3=a9vue
Le 13/11/2017 à 17:53, rm a écrit :
Bon courage,

bon, je laisse tomber