locked
How do I open new links in a JavaScript pop-up window (same window) not a new tab? RRS feed

  • Question

  • User1106268818 posted

    I got an ASP.NET solution in which users can click on a hyperlink and have a small JavaScript modal/pop-up window opened. When I tried to open a new link within the pop up window, it would be opened in a new tab of the main window (not the modal window) which did not meet my client's requirements. Here is the hyperlink url property in my webform:

    hyperLink1.NavigateUrl = "javascript:window.open('https:////www.google.com/search?rlz=1C1RLNS_enUS864US870&tbm=shop&q=dietary+supplement+for+diabetes&spell=1&sa=X&ved=0ahUKEwjfjNjg78XpAhXTu54KHckBC4kQBQiXAygA&biw=1680&bih=890', null, 'top = 100,left = 200,width = 1200,height = 800')";

    I just want to ask if it is possible to have the window configured for new links to stay being opened within the same pop-up/modal window not the main window? Or this is something has to do with the browser preferences on opening a new link?

    Any help would be much appreciated!

    Tuesday, May 26, 2020 7:48 PM

All replies

  • User-939850651 posted

    Hi,  Matt4402

    I suggest that you could try to use the Edge browser. When you click on the hyperlink of the page, a new pop-up box will always appear at the top of the page instead of the main window. This may be more in line with your customers' needs.

    I create a demo and I think ,that it is not feasible to use window.open() in JavaScript.

    Because the pop-up window is a closed page, you can’t even modify the information in the address bar, and the clicked hyperlink displays a new tab, so the two cannot be displayed at the same level.

    For more details, you can refer this document.

    Best regards,

    Xudong Peng

    Thursday, May 28, 2020 9:38 AM