You need to sign in to do that
Don't have an account?
Satyo Iswara
Javascript redirection won't work in visualforce page
I tried this code for a simple redirection from custom page to record page, but it seems I kept getting cross domain error.
Anybody encounter this? If yes, is there any known workaround beside using Apex Class?
Anybody encounter this? If yes, is there any known workaround beside using Apex Class?
<apex:page showHeader="false" sidebar="false"> <script type="text/javascript"> window.onload = init; function init(){ var button = document.getElementById('testButton'); button.addEventListener('click',redirectFunct); } function redirectFunct(){ window.location.href = '/' + '{!$CurrentPage.parameters.id}'; return false; } </script> <input type="button" value="hello world 2!" onclick="redirectFunct()"/> <button id="testButton"> hello world </button> </apex:page>
try this:
var link = "/" + "{!$CurrentPage.parameters.id}";
window.location = link;