You need to sign in to do that
Don't have an account?
Swapnil Patne 20
A command button on a Visualforce page and upon click I need to open a URL in an iFrame
Hi all,
I have a command button on a Visualforce page and upon click the URL should open in an iFrame i.e. a web page inside an iFrame
Idea is to display 'Button' on VF page and below that iFrame (both in VF page) and upon clicking the button it opens the URL/web page in an iFrame..
My development expertise are very limited and I've been researching and learning how to do things, but here is my code I am working.. please can you help me resolve the issue or with the correct code..?
<apex:page sidebar="False">
<apex:form >
<apex:commandButton onclick="toGoogle();" value="Google"/>
</apex:form>
<script>
function toGoogle() {
redirectTo('http://www.google.com');
}
function redirectTo(target) {
if (inIframe()) {
// step out of an iframe (if opened via iframe)
window.top.location.href = target;
return false;
} else {
window.location.href = target;
}
}
function inIframe() {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}
</script> -->
</apex:page>
Thanks in advance.
Swapnil
I have a command button on a Visualforce page and upon click the URL should open in an iFrame i.e. a web page inside an iFrame
Idea is to display 'Button' on VF page and below that iFrame (both in VF page) and upon clicking the button it opens the URL/web page in an iFrame..
My development expertise are very limited and I've been researching and learning how to do things, but here is my code I am working.. please can you help me resolve the issue or with the correct code..?
<apex:page sidebar="False">
<apex:form >
<apex:commandButton onclick="toGoogle();" value="Google"/>
</apex:form>
<script>
function toGoogle() {
redirectTo('http://www.google.com');
}
function redirectTo(target) {
if (inIframe()) {
// step out of an iframe (if opened via iframe)
window.top.location.href = target;
return false;
} else {
window.location.href = target;
}
}
function inIframe() {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}
</script> -->
</apex:page>
Thanks in advance.
Swapnil
http://salesforce.stackexchange.com/questions/126654/embedding-iframe-external-page-to-visualforce-page-iframe-is-showing-blank-page