CRM 2011 - Open a Popup from a page in an IFrame - javascript

In CRM2011 I have an IFrame that displays a custom ASPX page (a photo gallery). From that page when they click a photo, a new popup should appear with the photo in real size.
What do I have to do to make this work? I tried several methods, none of them are working. It works fine when I'm opening the page in a browser! When I click on a photo, the real sized photo opens in a new screen.
My methods with javascript are :
click => When I use that method, it opens a new window with the complete page that is shown in the IFrame. If the iframe is "http://myPage.aspx", it will open a new window with "http://myPage.aspx" instead of the photo....
<span onclick="window.open(....)">click</span> => Nothing Happens
click => Same happens like method 1
I've tried many other things, but none of them had the wanted effect...
Kind Regards,
Frederic

Thx for your reply.. But unfortunately, it doesn't work. It still opens the same page in a new browser while clicking on it in an IFrame, instead of a popup.
It even gives me a weird behavior when I click on it opened in a normal browser. It opens an popup, but it also opens a second screen with the page itself.
So I still haven't found a way to open it correctly from an IFrame.
Kind Regards,
Frederic

My problem is solved... Somebody has activated the "Restrict cross scripting" on the iframe on the CRM. It works like a charm now, when i deactivate that option!
Thx for the help!

I would change this code:
click
So that it has a target and the script is identified as JS:
click

Related

window.open() in new tab are not subject to pop-up blockers

I want to open new tab window on some condition for example:
var temp=true
if(temp)
window.open('test.aspx');
My problem is window.open() in new tab should not subject to pop-up blockers.
I have tried window.open('viewReport.aspx', '_newtab' ); and window.open('viewReport.aspx', '_blank' );, but its always subject to pop-up blocker.
Please provide any solution.
Thanks.
Window.open will force opening a new tab with a given URL. This is called a Pop-Up.
You cannot control it.
Instead use javascript to simulate a windows by using ex. https://jqueryui.com/dialog/ or http://fancybox.net. Both works with ajax request so you can pull the html content from another page.
My problem is window.open() in new tab should not subject to pop-up blockers.
You might think that but the people writing web browsers do not.
You cannot open a new tab or window from JavaScript except in response to a user event.
The solution is to find some other way to present your information (such as providing the user with a link to it or placing it in the same page).
Create a jquery popup div in ‘on click trigger’ event, that pop up displays with opacity background and it will remains center the popup if you scrolling zoom out the browser and closing it fadeout, and also you can customize the content of the popup div for your cool website designs.
Working example: http://istockphp.com/jquery/creating-popup-div-with-jquery/#sthash.5HcIfl8n.dpuf

Javascript - Doesn't want Refresh parent page after closing Iframe Modal box

The basics: I have a webpage where a user can click on the iframe to view the picture of car,as soon as i click on the iframe the parent page get refresh but the URL doesn't change..nevertheless it seems only chrome browser is affected..have check same scenario in other browser but its working fine
We need to see the code to say what you have done with the iframe.But here is a similar question and see if you are experiencing the same problem with the code.
Clicking an anchor inside an iFrame behaves differently in Firefox and Chrome

How to disable maximize,mimimize and close button for a new window open

I am using window.open() method to open a page as a pop-up window for a link button click event.
But the poup-up window is having minimize,maximize,close(x) button.
I dont want those buttons. How can remove these buttons?
This is the method i am using,
window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,titlebar=no,scrollbars=1,resizable=0,width=450,height=310,left=500,top=350");
Tell me how can do this.
Regards,
Chirag Jain.
You can't.
If you want a popup style window without full window decorations you'd have to create a new overlay <div> on top of the existing content and fill that with content, perhaps using an <iframe>.
You can't do it from javascript alone. Think about it, if you could, then people could put it into code on web-pages and cause other people's computers to open windows they couldn't easily close.
Instead you'll have to look for an answer specific to whichever browser you're using to host this application, and change it on the computers of your users appropriately. Even then though I don't think you'll be in luck (with Firefox for example, I can see how to get rid of them on all browser windows, but not on just one).

How to open a popup in a new tab but keeping the user on the caller tab?

I need to open a page in a new tab. That page has a XAML app that prints a special barcode we use in our web application. We manage to do that with a simple window.open. The problem is that besides opening the page, IE moves to that tab in stead of staying in the current tab. I've tried
//open the printing window
win2 = window.open('printingPage.aspx');
//set focus back to opener page
win2.blur();
window.focus();
window.document.focus();
but none of that worked. Is there a way to avoid that? I need this to work with IE 9+, we don't care for other browsers nor versions (for now at least).
Thanks in advance!
You can't control how the browser toggles display of the tabs.
If you can inform your users, they can press CTRL before clicking the link or middle click (the scroll wheel on most mice) to open the tab "in the background" but that's about all you can do.

Keep Chrome extension popup open while navigating to a new page

I'm developing a Google Chrome extension with a popup (it's a browser action), and it changes the location of the page, which makes the popup disappear. How can I make it stay between page reloads?
You can't. browserAction popups are closed on any activity outside of the popup. You could potentially use Desktop Notifications though.
You'll need to use Background Page, and pull information from it every time you load the popup. Background pages run whether or your extension is currently being used or not.
Not sure if this helps, but from the FAQ:
Can extensions keep popups open after the user clicks away from them?
No, popups automatically close when the user focuses on some portion of the browser outside of the popup. There is no way to keep the popup open after the user has clicked away.
I had to implement a workaround for this as well. In my case, I was trying to use auth0's loginWithPopup. When the popup closed, it returned focus to the chrome window instead of the extension which caused the extension to close before authorization fully completed. I worked around it by opening a new window which acts as a barrier of sorts to prevent chrome's focus from going back to the window the extension was opened from. Anyway, just wanted to put it out there in case it helps someone in the future.

Categories