最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to open a new PWA window from inside the PWA? - Stack Overflow

programmeradmin0浏览0评论

I'm trying to open a new window of my PWA application inside of it. But when I click on the anchor a new chrome tab is open.

Anyone can help me to open two instances of my PWA application?

An example of it is outlook, where you can open a new window of the application to write your email.

Thanks

I'm trying to open a new window of my PWA application inside of it. But when I click on the anchor a new chrome tab is open.

Anyone can help me to open two instances of my PWA application?

An example of it is outlook, where you can open a new window of the application to write your email.

Thanks

Share Improve this question edited May 2, 2022 at 19:22 luiscla27 6,4692 gold badges44 silver badges54 bronze badges asked May 4, 2020 at 17:16 Lucas GaunaLucas Gauna 1592 silver badges5 bronze badges 4
  • How about iframes? – Dr. Acula Commented May 4, 2020 at 18:39
  • Today I figure it out what to do. You need to open the windows using the window.open function... – Lucas Gauna Commented May 5, 2020 at 12:01
  • 1 Sorry that you have a negative score from this question, I don't know why. It has helped me and thanks for posting the answer as well – Mark Adamson Commented Feb 2, 2022 at 22:11
  • I found a duplicate question stackoverflow./questions/75563889/… but the answer on this page is NOT AN ANSWER – Joshua Robison Commented Feb 25, 2023 at 8:04
Add a ment  | 

2 Answers 2

Reset to default 6

The solution was very easy, I just need to open the new window using the window.open, and not using the anchor tag (A).

Documentation about this function:

https://developer.mozilla/pt-PT/docs/Web/API/Window/open

For this to work, you have to pass width and height attributes, I couldn't find any documentation for that requirement, but it just works, example:

window.open('https://my.app.domain/route.to/something', null, 'width=600,height=400');
function newWindow() {
window.open("https://WEBADRESS/index.html","_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=900, height=700");
}

Feel free to arrange the settings as you like.
Found the answer on this site.

https://www.w3schools./js/tryit.asp?filename=tryjs_openallwindow

Unfortunately they have an error in their code. I fixed it.

发布评论

评论列表(0)

  1. 暂无评论