How to redirect parent window from an iframe action

0 votes
What JavaScript do I need to use to redirect a parent window from an iframe?

I want them to click a hyperlink which, using JavaScript or any other method, would redirect the parent window to a new URL.
Sep 2, 2020 in Java-Script by kartik
• 37,510 points
13,339 views

1 answer to this question.

0 votes

Hello @kartik,

Use this:

window.top.location.href = "http://www.example.com"; 

Will redirect the parent iframe.

Hope it helps!!

Thank You!!

answered Sep 2, 2020 by Niroj
• 82,880 points

Related Questions In Java-Script

0 votes
1 answer

How to access iFrame parent page using jquery?

Hello @kartik, To find in the parent of ...READ MORE

answered Sep 3, 2020 in Java-Script by Niroj
• 82,880 points
9,239 views
0 votes
1 answer

How to embed an External Page Without an Iframe?

Hello @kartik, You could load the external page ...READ MORE

answered Sep 9, 2020 in Java-Script by Niroj
• 82,880 points
10,003 views
0 votes
1 answer

How to manage a redirect request after a jQuery Ajax call?

Hii kartik, You can resolved this issue like ...READ MORE

answered Apr 27, 2020 in Java-Script by Niroj
• 82,880 points
28,258 views
0 votes
1 answer

How to access PHP session variables from jQuery function in a .js file?

Hello, You can produce the javascript file via ...READ MORE

answered Apr 29, 2020 in Java-Script by Niroj
• 82,880 points
12,311 views
0 votes
1 answer

How to access PHP var from external javascript file?

Hello @kartik, You don't really access it, you ...READ MORE

answered Jul 6, 2020 in Java-Script by Niroj
• 82,880 points
7,180 views
0 votes
1 answer

How do I escape a single quote in SQL Server?

Hello @kartik, Single quotes are escaped by doubling ...READ MORE

answered Jul 21, 2020 in PHP by Niroj
• 82,880 points
5,889 views
0 votes
1 answer

How to specify a port to run a create-react-app based project?

Hello @kartik, You could use cross-env to set the port, ...READ MORE

answered Jul 22, 2020 in Angular by Niroj
• 82,880 points
5,339 views
0 votes
1 answer

How do you set a default value for a MySQL Datetime column?

Hello @kartik, In version 5.6.5, it is possible ...READ MORE

answered Aug 18, 2020 in PHP by Niroj
• 82,880 points
7,408 views
0 votes
1 answer

How to call a parent window function from an iframe?

Hello @kartik, Using Window.postMessage() This method safely enables cross-origin communication. And if ...READ MORE

answered Sep 3, 2020 in Java-Script by Niroj
• 82,880 points
3,594 views
0 votes
1 answer

How to show a different value from an input that what will be received as php?

Hello @kartik, You can't change the field's value ...READ MORE

answered Jul 8, 2020 in Java-Script by Niroj
• 82,880 points
9,999 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP