Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Is it possible instruct a page to open in a child window?

Posted on 2012-12-27
6
Medium Priority
?
240 Views
Last Modified: 2013-02-25
Hello all,

I have some html code that I need to open in a child window.

This is easy to accomplish if I am calling this html code through other html.

Example:
<script type="text/javascript">    
window.open("page_to_open_in_child_window.html","","location=0,toolbar=0,status=0,resizable=1,width=800,height=600");</script>
<body>

Open in new window


But in my situation, I have no access or control over what is calling my "page_to_open_in_child_window.htm". I have tried renaming this file and using the above code in a redirector and it worked... except unfortunately (this is an LMS), using the redirector idea causes the LMS session data to not be retained.

Question is, can I embed the same instructions inside of my "page_to_open_in_child_window.htm"? Can this be done through HTML and/or javascript and/or CSS?

Thanks
0
Comment
Question by:Shawn Connelly
  • 3
  • 3
6 Comments
 
LVL 10

Expert Comment

by:tdlewis
ID: 38725818
If you want to fully load the content from your script then leave the first argument to window.open blank, e.g.,

myWin = window.open("","", "location=0,toolbar=0,status=0,resizable=1,width=800,height=600");

Then you can do something like this:
myWin.document.writeln("<html><body>Hello, world!</body></html>")

In that way, you don't need a pre-existing webpage.

On the other hand, if you need for something to be loaded by the LMS so that you have its session data then create a super simple page. It can be as simple as:
<html><body></body></html>

Then you can do something like this:
myWin.document.body.innerHTML += "Hello, world!<p>"
0
 
LVL 4

Author Comment

by:Shawn Connelly
ID: 38738993
Hello tdlewis,

Thanks for your response but not even close. LOL  Though, I suspect my description wasn't nearly good enough.

The problem is that in opening a child window, I must also carry a two-way communications with the parent window API. This is where it is slightly more complicated than simply opening a child window.
0
 
LVL 10

Expert Comment

by:tdlewis
ID: 38739019
OK. Can you give a brief description of what you need the parent and child windows to do?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 4

Author Comment

by:Shawn Connelly
ID: 38739053
Hello tdlewis,

This might be beyond the scope of a EE question but here goes... I have attached two files.

First is the index.html - this file is the first to load and it establishes the API and then
opens...

Test-sample.htm - there is more variables (part of the API) and this file then opens the FLASH file (not included).

Throughout this process, the API calls establish a 2 way comm link from the LMS to the FLASH file (lesson actually).

What I am trying to accomplish is to open that Flash lesson in a child window and maintain the 2 way comm link to/from the LMS.

What do you think?
Test.zip
0
 
LVL 10

Accepted Solution

by:
tdlewis earned 2000 total points
ID: 38742781
In a prior life I wrote some code for a different LMS where the page loaded by the LMS opened a child window that communicated back to the parent window about its progress. I no longer have access to any LMS nor the code for that prior project, but it worked by having the parent set a variable in the child that then gave the child access to routines in the parent. It worked something like this:
theChild = window.open("page_to_open_in_child_window.html","","location=0,toolbar=0,status=0,resizable=1,width=800,height=600");
theChild.theParent = this;

Open in new window

This allows the child to do things like this:
theParent.customCode();

Open in new window

As I look at the sample pages you uploaded, it looks like your child window has a lot of LMS code embedded in it. That might work if the data needed by the script to communicate with the LMS is present. If it's not, then you might need to substitute the code you've got with stubs that pass the processing back to the parent. For example in the child:
window.ProcessLMSResult = function(requestType, responseStr)
{
	theParent.ProcessLMSResult(requestType, responseStr);	
};

Open in new window

I hope that helps!
0
 
LVL 4

Author Closing Comment

by:Shawn Connelly
ID: 38927659
tdlewis: For all your effort, thank you.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question