0

При нажатии на ссылку открывается новое окно. как открыть эту страницу в div или еще как (можно поверх ) . Сайт написан на laravel

Скрипт открывает новое окно, а как открыть на той же странице ?введите сюда описание изображения

<script>
function showInstructions(url) {
    width = screen.availWidth;
    height = screen.availHeight;
    window.open(url,'_blank',"height="+height+",width="+width+", toolbar=no, top=0,left=0,location=no,menubar=no, directories=no, status=no, menubar=no, scrollbars=yes,resizable=no");

    runner();
}

function runner()
{
    url = localStorage.getItem('redirect_url');
    if(url) {
      localStorage.clear();
       window.location = url;
    }
    setTimeout(function() {
          runner();
    }, 500);

}
</script>
1
  • Посмотрите в сторону JQueryUI... там точно есть то что вам нужно 2 окт 2018 в 23:14

1 ответ 1

0
const cb = function () {
  const popup = document.createElement('div');

  popup.id = 'instructions-popup';
  popup.style.position = 'fixed';
  popup.style.width = '80%';
  popup.style.height = '80%';
  popup.style.top = '10%';
  popup.style.left = '10%';
  popup.innerHTML = this.response;

  document.body.appendChild(popup);
};

const showInstructionsPopup = (url) => {
  const popup = document.getElementById('instructions-popup');

  if (popup) {
    popup.remove();
  }

  const xhr = new XMLHttpRequest();

  xhr.addEventListener('load', cb);
  xhr.open('GET', url);
  xhr.send();
};

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.