Changing protocol to HTTPS in framed pages

K

ksuralta

Hi everyone,

Hope somebody can help me with this.

I have a framed window.
--------------------------------
Frame 1
--------------------------------
|
2 | Frame 3
|
|
--------------------------------

There is a link in Frame 3 that I would like to do two things.

1) redirect the main URL to HTTPS..
2) redirect Frame 3 to a new HTTPS page.

Here's my code:
function redirect_to_https()
{
hostname = window.location.hostname;
window.location.href = "https://" + hostname;
top.<frame 3 name>.location = "https://" + hostname + "<new
page>";
}

Problem here is it reloads the entire frame with the default page in
Frame 3, and not the <new page>.

Is there a way to do this without using a pop-up window (due to pop-up
blockers) that will redirect the frames properly?


Thanks,
Kenneth
 
S

Stevo

There is a link in Frame 3 that I would like to do two things.

1) redirect the main URL to HTTPS..
2) redirect Frame 3 to a new HTTPS page.
Here's my code:
function redirect_to_https()
{
hostname = window.location.hostname;
window.location.href = "https://" + hostname;
top.<frame 3 name>.location = "https://" + hostname + "<new
page>";
}

The second line of that function should use top.location.href.

The 3rd line is pointless because the top is already redirecting.
Anything you do to frame 3 is about to be nuked courtesy of line 2. You
might not even ever get to execute that 3rd line once you change line 2
to use top.location.href.
 
T

Thomas 'PointedEars' Lahn

[...]
There is a link in Frame 3 that I would like to do two things.

1) redirect the main URL to HTTPS..
2) redirect Frame 3 to a new HTTPS page.

Here's my code:

Where is it placed is important here. Anyway, this cannot work.
function redirect_to_https()
{
hostname = window.location.hostname;
window.location.href = "https://" + hostname;
top.<frame 3 name>.location = "https://" + hostname + "<new
page>";
}

If this code is contained in the frameset document, the location of that
will change and so line 3 will never be executed (reliably).

If this code is contained in the frame document, lines 2 and 3 address
the same target: the current frame.
Problem here is it reloads the entire frame with the default page in
Frame 3, and not the <new page>.

Of course. With line 2, you are, as we say here, sawing off the branch
that you are sitting on.
Is there a way to do this without using a pop-up window (due to pop-up
blockers) that will redirect the frames properly?

Yes. https://securesite.example/whatever?new_page

You would need to have control over securesite.example, of course. And I
recommend a server-side solution.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top