How to hide url in the popup window opened using window.open

前端 未结 3 474
一个人的身影
一个人的身影 2021-01-16 01:47

I am using below code to open a popup window in my page:

window.open(\"myPopupWindow.html\", \"_blank\", \"height=400, width=550, status=yes, toolbar=no, men         


        
相关标签:
3条回答
  • 2021-01-16 02:15

    Are you just trying to mask the address, to make it look nicer or hide the fact that you're linking to to another website, or is it that you don't want people to know they can access that page without using your popup?

    If it's the former, then what you could do is make the page you open in window.open an iframe, and point the iframe to your actual page. They user could still access the target page, but only via your nicer looking url.

    The other option is to use something like a colorbox with an iframe instead of window.open, which will mask the address. Have a look at the Outside Webpage (iframe) example on this page.

    Of course whichever option you choose, someone smart can still track down the target url via the source code and go there directly.

    0 讨论(0)
  • 2021-01-16 02:16

    Simple solution open new tab after that add url to location.href.

    window.open('','_blank').location.href = "url"
    
    0 讨论(0)
  • 2021-01-16 02:25
    window.open('http://mysite/proxy.html')
    

    and in proxy.html :

      <html>
           <body> 
              <iframe src="/realPage.html"></iframe>
           </body>
    
      </html>
    
    0 讨论(0)
提交回复
热议问题