Добрый день, у нас есть веб-приложение, которые подключается через айфрейм, пару дней назад скрипт яндекс карт начал выдавать кросс доменную ошибку.
наименование доменов изменено.
_YMaps.js?v=1.1.21-57:11 Uncaught SecurityError: Blocked a frame with origin "domain" from accessing a frame with origin "domain". Protocols, domains, and ports must match.
Она возникает даже в том случае, если домены совпадают.
Ниже прикрепил пример, где созданы два файла с картой API 1 ymaps1.html и API 2 ymaps2.html и test.html, в котором открываются html с картами через iframe. Ошибка здесь тоже происходит, и только в первой версии API карт.
_YMaps.js?v=1.1.21-57:11 Uncaught SecurityError: Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match.
ссылка на архив - https://yadi.sk/d/RwNt2cuqreX4B
код test.html
<html> <body> test API v1 <br/> <iframe name ='ps' width="100%" height="655px" scrolling="no" frameborder="0" src='ymaps1.html'></iframe> <br/> test API v2 <br/> <iframe name ='ps' width="100%" height="655px" scrolling="no" frameborder="0" src='ymaps2.html'></iframe> <body> </html> <script>
код ymaps1.html
<html>
<head>
<script type='text/javascript' src='http://code.jquery.com/jquery-2.1.1.min.js'></script>
<script src="https://api-maps.yandex.ru/1.1/index.xml" type="text/javascript"></script>
</head>
<body>
<div id="map" style="width: 600px; height: 400px"></div>
</body>
</html>
<script type="text/javascript">
$(function() {
init();
var myMap,
myPlacemark;
function init(){
myMap = new YMaps.Map(YMaps.jQuery("#map")[0]);
myMap.setMaxZoom(8);
myMap.addControl(new YMaps.Zoom({ noTips: true }));
myMap.enableScrollZoom();
myPlacemark = new YMaps.Placemark(new YMaps.GeoPoint(55.76, 37.64));
myPlacemark.name = 'Москва!';
myMap.addOverlay(myPlacemark);
}
});
</script>код ymaps2.html
<html>
<head>
<script type='text/javascript' src='http://code.jquery.com/jquery-2.1.1.min.js'></script>
<script src="https://api-maps.yandex.ru/2.0-stable/?load=package.standard&lang=ru-RU" type="text/javascript"></script>
</head>
<body>
<div id="map" style="width: 600px; height: 400px"></div>
</body>
</html>
<script type="text/javascript">
$(function() {
ymaps.ready(init);
var myMap,
myPlacemark;
function init(){
myMap = new ymaps.Map ("map", {
center: [55.76, 37.64],
zoom: 7
});
myPlacemark = new ymaps.Placemark([55.76, 37.64], {
hintContent: 'Москва!',
balloonContent: 'Столица России'
});
myMap.geoObjects.add(myPlacemark);
}
});
</script>