Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open.window in iframe

I am making a simple webpage for fun and I am a noob at JavaScript and I want to make windows open up when clicked and I want to open them up inside an iframe and I want to give it all the functionality of a normal window.open and I also want it to maximize the windows but inside the iframe and not outside. I know About the window.open and go it to work I just want to make the windows work inside an iframe and not outside. I am using Notepad for as my editor. This is my first question so please forgive me if I made any mistakes thanks.

like image 735
Unknown Avatar asked Dec 31 '12 18:12

Unknown


People also ask

Can an iframe open a window?

An <iframe> tag hosts a separate embedded window, with its own separate document and window objects. We can access them using properties: iframe. contentWindow to get the window inside the <iframe> .

Can I open new tab from iframe?

By adding target="_blank" to the anchor, it will open it in a new tab. By adding target="_parent" to the anchor, it will open it up in the same window like a normal link.

How do I get the window object of an iframe?

The contentWindow property returns the Window object of an HTMLIFrameElement. You can use this Window object to access the iframe's document and its internal DOM. This attribute is read-only, but its properties can be manipulated like the global Window object.


1 Answers

If you want to open a window within an iframe:

  1. Create the iframe with a name.

     <iframe name="theFrame"></iframe>
    
  2. Now use the script this way:

     window.open(url, "theFrame");
    
like image 74
Praveen Kumar Purushothaman Avatar answered Oct 07 '22 17:10

Praveen Kumar Purushothaman