w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
window.parent.postMessage parent check what iframe sent message
You can only check which domain sent the message. If you need more identification you can always layer it into your messaging system. Send messages like: message = { "source": "menu", "message": "click on entry" }; Each frame then has their own source. You will need to serialize the message, JSON works nicely.

Categories : Javascript

How to redirect to parent window after logging in from iframe window?
As long as the links (within the iFrame) are part of the other page, you can't "hijack" their target. You would have to have the means and ability to modify the target attribute of each link to point to _parent or use javascript to reference the window.parent. Based on what you're saying (you're logging in to a different domain and the page is not part of your site) this wouldn't be possible without implementing some kind of proxy where you could modify the contents between page visits.

Categories : Javascript

Get iframe html or name from parent window
If you pass a parameter to the test function it will work: $(document).ready(function() { parent.test('name of this iframe'); } OR even better $(document).ready(function() { parent.test(window.name); } Then you just need to use that value passed to the inside of the test function.

Categories : Javascript

Accessing parent window from facebook iframe
The iFrame domain must match the parent domain to be able to access it directly. If I remember correctly, Facebook offer a "Fluid" option for the canvas size (which sets the iFrame width to 100%). If Facebook still offer this, you could place your content in a container div and add onLoad and onResize events with jQuery in the iFrame document. You could then set the size of the container based on the iFrame document size.

Categories : Javascript

iframe jquery dialog in parent window
If you put the div in the parent page, you can call a function within the parent page to show the dialog from inside the iframe. For example, placing this within the iframe: parent.functionName(); Will call the function functionName within the initial page, from the iframe.

Categories : Jquery

access http within iframe from https parent window
See the ProxyPass directive. You can't use it in the htaccess file but you can use the P flag in mod_rewrite as long as mod_proxy is loaded. Something like: RewriteEngine On RewriteCond %{HTTP_HOST} ^site1.com$ [NC] RewriteRule ^special-url-to-point-to-site2$ http://site2.com/special-url-to-point-to-site2 [L,P] In your server/vhost config (for site1.com) you can use proxy pass: ProxyPass special-url-to-point-to-site2 http://site2.com/special-url-to-point-to-site2 Make sure to checkout ProxyPassReverse which adjusts the url's in response headers to point them back to site1.

Categories : Javascript

How to access a method of parent window of an Iframe [Chrome browser ]
You should try with document.getElementById("iframe-1").contentWindow.func(); or var $f = $("#myIFrame"); var fd = $f[0].document || $f[0].contentWindow.document; // document of iframe fd.MyFunction(); // run function Docs

Categories : Javascript

Can I use a CSS class to style a div inside an iframe to be the parent window's width and hight?
No, you'll need to make the iframe go full screen as well. As far as the contents of the iframe are concerned the iframe is the window, so going full screen inside the iframe will only make it the size of the iframe. But if you resize the iframe to be full window, then its contents can be full as well, provided you have no border, padding or margins on your iframe.

Categories : Javascript

Error; Cross-Domain iframe failing when it attempts to access property of element in parent window
a cross-domain request will produce an error, I don't think any browser will allow this in the 21st century. . What that page is trying to do is load an attribute 'ug' from one of the elements in it's parent window. . .what that attribute is? you'll have to figure that out yourself, unless there's a tutorial that you were referencing while doing what you were doing, then I suggest you refer to it and go over the details once more, because you're obviously missing something. you cannot change the contents of an iframe from the parent window for security reasons, modern browsers will not allow this. hackers would use such functionality to exploit users. from what the error says, something like this is happenning in that iframe; var parentWindowTextElementsUGProperty = window.parent.getEle

Categories : Javascript

How do I bring parent window in front of child modeless dialog when parent window clicked
Take out this line: Owner = Application.Current.MainWindow and you should get the behavior you want. By specifying the owner window you are keeping the child window always in front.

Categories : Wpf

IE10 does not support stylesheet link in iframe
innerHTML of head is read-only in IE, the snippet below does the trick: $('#dialogIframe') .contents().find("head") .append($('<link rel="stylesheet" type="text/css" href="/css/main.css">') ); Just in case somebody would need to do this with pure JavaScript, here's the code: var doc = document.getElementById('dialogIframe').contentWindow.document, sheet = doc.createElement('link'); sheet.rel = 'stylesheet'; sheet.type = 'text/css'; sheet.href = '/css/main.css'; doc.documentElement.appendChild(sheet);

Categories : Javascript

JQuery - Apply Stylesheet to Iframe (same domain)
The following modification below fixed the outcome: <?php $storedhtml = '<strong>Testing</strong><br><br>lots more html text......'; ?> <iframe id="lovely_pages" src="about:blank" style="width:99%;height:700px;" frameBorder="0"></iframe> <script language="javascript" type="text/javascript"> $(document).ready(function(){ $('#lovely_pages').contents().find('head').html('<link href="/styles/iframe_only.css" rel="stylesheet" type="text/css">'); $('#lovely_pages').contents().find('body').html('<?php echo $storedhtml; ?>'); }); </script>

Categories : Jquery

How do I let one iframe's button act upon another iframe with the script in parent page?
You should be able to access the buttons using: document.frames['left'].document.getElementById('myButton') Here's a related SO question

Categories : Javascript

iframe how to use parent javascript file in iframe
You have to include it twice, but the server will cache it. So the client is downloading 255KB the first time, and remembers it has downloaded the document already, so it won't download it a second time. Also see the w3c specification and this tutorial. You would have to add the following lines (for example) to your .htaccess to enable caching (it's enabled by default by the most webhosters): # Cache all your static assets for 1 month <filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> Header set Cache-Control "max-age=2592000, public" </filesMatch> Additionally you can enable gzip-compression, which will minimize the traffic even more. It's described in this tutorial.

Categories : Jquery

Loading indicator stays in Firefox after iframe finished loading
Why are you triggering the write to the contentWindow by using the load event of the same iframe in the first place? An alternate approach just creates an iframe and loads some content with images into it - works on firefox as expected. No big deal. <!DOCTYPE html> <html> <head> <script type="text/javascript"> function createIframe(){ var f = document.getElementsByTagName('body') [0].appendChild(document.createElement('iframe')); f.contentWindow.document.write('<img src="http://www.funimage.org/uploads/posts/2013-02/1361892989_1_14.jpg" />'); } </script> </head> <body onload="createIframe()"> </body> </html>

Categories : Javascript

How do I detect when an iframe starts loading and when it finishes loading
You can try following jquery code: $(document).ready(function(){ alert("Iframe Start Loading ..."); var ifr=$('<iframe></iframe>', { id:'frame', src:'http://ernagroup.com', style:'display:none', load:function(){ $(this).show(); alert('iframe loaded !'); } }); $('body').append(ifr); });

Categories : Javascript

Stylesheet not loading. URL duplicating on click
Easy fix <link href="www.easybuildingproducts.castyles/inside.css" rel="stylesheet" type="text/css"> That needs to be either one of the following <link href="/styles/inside.css" rel="stylesheet" type="text/css"> or <link href="http://www.easybuildingproducts.ca/styles/inside.css" rel="stylesheet" type="text/css"> I looked at the actual website source to find this example. there are quite a lot like it

Categories : PHP

Stylesheet not loading on mobile devices
Every browser have own pre-defined stylesheet. Try this CSS reset: http://css-tricks.com/snippets/css/meyer-reset/

Categories : CSS

Calling a parent function from within an iframe WITHOUT using parent.someFunction()?
You can use into a frame or iframe: window.parent.someFunction(parameters) to call a function in a window up one level. window.top.someFunction(parameters) to call a function the maximum level window. In others words, the container window of all. For example, this is the JavaScript in the window container: function someFunction(msg) { alert(msg +"!!!"); } In the frame or iframe you can use with a button: <button onclick="window.top.someFunction('message');">Trigger function</button> However, if you want to use a "alias", then you can use this JavaScript: var aliasFn = window.top.someFunction; After, when you want to use it: <button onclick="aliasFn('message');">Trigger function</button> Hope that helps.

Categories : Javascript

loading separate css stylesheet (heroku nodejs)
You are using a relative path to the css file. This path is relative to the server root and not to the html file. I have no experience with Heroku NodeJS but I think the path should be /css/index.css

Categories : CSS

Apply css stylesheet to inline svg element without loading it on the page
Something like this perhaps? <script> var stylesheet = document.styleSheets[0]; var fil0 = stylesheet.cssRules[2].cssText; var path = document.getElementById("_261044752"); path.removeAttribute("class"); path.setAttribute("style", fil0.substring(fil0.indexOf("{") + 1,fil0.lastIndexOf("}")).trim()); </script> If you want to do this with lots of elements you can call document.getElementsByClassName("fil0") and loop through the results.

Categories : Javascript

Switching to Parent Frame from iFrame and finding an element in Parent frame using Selenium Webdriver. C#
Thats for your responses guys. It is solved! The solution: While I use the webDriver.SwitchTo().DefaultContent(); it switches the webDriver to the top most window of the page. [Previously I was looking for the button element in this window and therefore was not able to find it as the button was sitting in the main frame of the page] After switching to the main window, I switched the webDriver again to the main frame of the page. This main frame had the button element. Thus I was able to find the button element. And this slved the issue! So the final code doesn't have webDriver.SwitchTo().DefaultContent(); but has the following in its place: _webDriver.SwitchTo().Window(windowHandle); _webDriver.SwitchTo().Frame("mainFrame"); Note: windowHandle in the above code is the hand

Categories : C#

How to get the attribute value from parent page.I tried using opener and window.parent.But doesn't work
Consider sending values "news1" and "image1.jpg" to page2 as URL arguments: <page2 URL>?news=news1&image=image2 Edited: Can you place your data into hidden inputs inside a form, and use your link to submit it (onclick="form.submit();")? This way you'll make a POST request instead of GET.

Categories : Javascript

How can I show alert in parent window from child popup window in javascript?
try this code <!DOCTYPE html> <html> <head> <script> function openWin() { myWindow=window.open('','','width=200,height=100'); myWindow.document.write("<p>This is 'myWindow'</p>"); refreshParent(); } function refreshParent() { window.parent.focus(); window.parent.alert("message"); window.parent.location.reload(); } </script> </head> <body> <input type="button" value="Open 'myWindow'" onclick="openWin()" /> </body> </html>

Categories : Javascript

Load another window in background; when rendered, close the parent window
Changed code to: InitWindow I = null; Thread C = null; public InitWindow() { InitializeComponent(); I = this; C = Thread.CurrentThread; Thread T = new Thread(() => { MainWindow M = new MainWindow(); M.Show(); M.ContentRendered += M_ContentRendered; System.Windows.Threading.Dispatcher.Run(); M.Closed += (s, e) => M.Dispatcher.InvokeShutdown(); }) { IsBackground = true, Priority = ThreadPriority.Lowest }; T.SetApartmentState(ApartmentState.STA); T.Start(); } void M_ContentRendered(object sender, EventArgs e) { // Making the parent thread background C.IsBackground = true; // foreground the current thre

Categories : C#

Accessing parent window angular scope from child window
I had a similar need and had the same problem accessing the scope using angular.element. I was was able to solve it as follows though: In your main/parent controller do something like this: $scope.food = 'Mac & Cheese'; window.$windowScope = $scope; $window.open('views/anotherWindow.html', '_blank','menubar=yes,toolbar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes,personalbar=yes'); Then in the child window controller you can access $windowScope like this: $scope.parentWindow = window.opener.$windowScope; console.log($scope.parentWindow.food); An alternative to putting data directly into the scope would be to use $window scope to broadcast and/or emit events, which is the preferred way of cross-controller communication in angular.

Categories : Javascript

Disable parent window when child popup window is open
Play around with this code in the pop-up: $(window).on("blur", function(){ ... }); This will fire every time the user leaves the window. Inside the argument function you should be able to make the window regain its focus, maybe using $(this).focus() or self.focus(). I haven't tested this myself. Good luck!

Categories : Javascript

parent.parent.window.location.href is not working
Well, if you are just trying to reload the parent window after closing fancybox, then just close fancybox from within the opened page (the way you are doing it) like <script> parent.$.fancybox.close(); </script> ... and reload the parent page from itself adding to your fancybox custom script the afterClose callback like $(".fancybox").fancybox({ // other API options here afterClose : function() { location.reload(); return; } }); On the other hand, if you are not just trying to reload the parent page but actually trying to redirect to another page, then use window.location.pathname if you are using a relative path or window.location.href for a full path. You may also want to try self.location.href. NOTE : afterClose is for fancybox v2.x, F

Categories : Javascript

Redraw in parent window in child window's onPaint in mfc
One way is to just pass data to the parent window and call its Invalidate function. Then it would paint the grid lines in its own OnPaint. Or you could paint directly on the parent window from the child, but use the parent's GetDC function instead of using the child's DC.

Categories : C++

Call JavaScript of parent window from child window
What you're looking for is a reference to the window that opened the popup window. Once you have that, you can call functions in that window, read and write variables in that window, or even manipulate its DOM. That reference is called opener. It gives you the window object for the window that opened the current window. For example, if you have a function in the original window like this: function updateMe( data ) { alert( data ); } then in the popup window you could call it like this: opener.updateMe( 'Hello!' ); Naturally, you need to make sure that updateMe() is a global function in the original page. Or if you have some object in the original page and updateMe() is a method of that object, you can still do it, as long as the object is global. e.g. in the host page: var myOb

Categories : Javascript

How to reload the parent window from a pop-up window by calling a JS function?
Window Launcher: <script type="text/javascript"> function launch() { window.open('opened.html'); } </script> <a href="#" onclick="launch()">Launch!</a> Launched Window: <script type="text/javascript"> function reload_parent() { parent.window.opener.document.location.reload(); } </script> <a href="#" onclick="reload_parent()">Reload!</a> This kind of problem does not lend itself nicely to jsfiddle.net, and can't be done on file:/// domain due to cross-domain security problems, so you will have to actually run a server to host this. localhost is fine. I have hosted it myself here for you to see: http://framba.ch/opener.html

Categories : Javascript

Going back from child window to parent window in Visual C++
First of all if you want to do some navigation kind of things then, Your code of going parent to child is also not work properly. Now what I suggest you is that for going from parent to child create one global variable. Like , Form2^ pp ; initialise it in constructor or create method of parent class Like, //Create method or constructor, pp = gcnew Form2(); And do your navigation Like, private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) { this->Hide(); pp->ShowDialog(); } In this case no matter how many time you click on button3 only one instance of child class will show and hide. No your problem is that you want go back to parent window form from child window. You may achieve this using this.Parent as Form Like, priva

Categories : Dotnet

Is it possible to receive messages from a parent window which is NOT the main window?
If a control is a child of a tab (or any other control) then it's the tab that will get notification messages like WM_COMMAND. It's easiest to make your controls all children of your main window and just fix the z-order to make them appear in front of the tab (you already have WS_CLIPSIBLINGS set on the tab control, which you would also need). If you leave the controls as children of the tab then the only way to get notification messages is to sub-class the tab. Or, you can do this the way property sheets do it, and use child dialogs (a dialog with the DS_CONTROL style set) to host the tab content. Then you can have a separate dialog procedure that handles messages from the child controls, and it makes it easy to show/hide a whole page of controls rather than handling them all individual

Categories : C++

How to pass data from Parent html window to pop-up window
You forgot to call transferText() :) After I called transferText() the text was transferred... <html> <head> <script type="text/javascript"> function init() { popupWin = window.open('','popupWin',''); popupWin.document.writeln('<html><head><title>test</title></head><body><form><input type="text" id="popupTextBox"/></form></body></html>'); popupWin.document.close(); popupText = popupWin.document.getElementById("popupTextBox"); parentText = document.getElementById("parentTextBox"); transferText(); } function transferText() { popupText.value = parentText.value } </script> </head> <body> <input type="text" id="parentTextBox"/> <input type="button" onclick=

Categories : Javascript

SetFocus to parent window, then back to child window
Big thanks to Hans Passant for solving this! The crash issue was due to my window handle being unreliable. I stopped storing the window handle in a variable, and instead I got it on the spot using GetParent(). I also didn't need to set focus to the current window, all I needed to do was replace my SendMessage with a PostMessage. So the new code: case WM_KEYDOWN: ...code to handle modifiers like shift, ctrl, etc... else { PostMessage(GetParent(win32Frame->getPlatformWindow ()), message, wParam, lParam); }

Categories : C++

Accessing the Parent Window's Content from the child window
The root of your problem is same origin policy that won't let you observe load events for external domains. If you try this in developer console while browsing SO, everything's fine: var child = window.open( 'http://stackoverflow.com' ); child.onload = function() { alert( 'Popup loaded!' ); // Fired! }; However if you try to open a page from other domain, it fails: var child = window.open( 'http://stackexchange.com' ); child.onload = function() { // It's not gonna be fired unless you run it from stackexchange.com. alert( 'Popup loaded!' ); }; The same thing happens when you call window.open() or window.open( '' ) as it tries to load about:blank page which is out of your domain's scope and that's why your browser won't fire attached events (same for child.addEventListene

Categories : Javascript

Gray and disable out the parent window as soon as pop up window is opened
Updated fiddle from answer in this question with iframe support http://jsfiddle.net/LT5JC/ Open function is rather simple function open(url) { $('#block').fadeIn(); // show grayed pane $('#iframe').attr('src', url); // update src of iframe $('#container').fadeIn(); // show container with iframe }

Categories : Javascript

How to get child window url from parent window using javascript
You can't detect the event precisely, but you can do a workaround and check the URL all X milliseconds. var self = this var detectsUrl = setInterval(function(){ var a = winRef.document.createElement('a'); a.href = winRef.document.URL; if (a.hostname == "www.myURL.com") { winRef.close(); clearInterval(detectsUrl); self.callback(); }; }, 1000); // Here we check every seconds

Categories : Javascript

Updating wpf parent window after some action on another window
Do insert operations inside main window (UserManagmentWindow): UserManagmentWindow.cs: // Inside add button handler open adduser window as dialog box... var result = adduser.ShowDialog(); if(result == true){ // user pressed OK button... // insert new user in database // refresh UserManagmentWindow } Post your code if you need more details...

Categories : C#

How to wait the loading of an IFrame?
My first guess is that you are trying to acces the iframe elemnt before it is generated in html. Try using: $(function(){ elFrame = parentContainer.find('iframe'); elFrame.load(function () { elFrame.contents().find('body').css('background-color', 'red'); }); }); The second guess is that the "parentContainer" is not right, making the iframe unreachable. How do you get it? What is it's value?

Categories : Jquery



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.