4

I have a WebView in an UWP app. The page shows a popup window by calling window.open (https://www.w3schools.com/jsref/met_win_open.asp). Is there a way for me to make this open in the WebView?

2 Answers 2

2

Is there a way for me to make this open in the WebView?

The open() method creates a new secondary browser window. If you want the new page to open also inside the WebView means that you don't want to create a new secondary browser window but navigate to another page in current window.

In that case, you could use window.location instead of window.open. For example:

<html>
<head>
    <script type="text/javascript">
        function open_win() {
            //window.open("http://www.microsoft.com")
            window.location = "http://www.microsoft.com"
        }
    </script>
</head>

<body>
    <form>
        <input type=button value="navigate to" onclick="open_win()">
    </form>
</body>
</html>
Sign up to request clarification or add additional context in comments.

2 Comments

I do not have control over the website source code.
@Ham.Abdu2, in that case, you may have no way to do this. Windows.open' create in another window, but WebView` it self is just one. What you are wanting is to change the server side feature.
0

I am going to assume that you want to navigate to another page in the current window, instead of a popup. Here is something that should be helpful. https://learn.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/web-view#navigating-to-content

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.