Open Webpage Inside the Html Body [Closed]

I use the following code for open webpage inside the HTML page.

but its opening in another tab instead of that html page.

I need to open google webpage inside of the HTML body instead of another tab?

2

In your HTML you might have something like

<body>

  <iframe id="myIframe" src=""></iframe>

</body>

Then in your function

var url = '

document.getElementById('myIframe').src = url;
<!DOCTYPE html>
<html>
<body>

<iframe src="">
  <p>Your browser does not support iframes.</p>
</iframe>

</body>
</html>

Look at w3school for this simple information.

I am guessing you trying open new page using _self. Try to add "_self" as next parameter in open. Read more here

Try following code

var Url = "";
window.open(Url, "_self");
Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest