如何在地址栏中隐藏网址?

时间:2014-11-19 05:45:13

标签: salesforce

我想隐藏地址栏中的网址。任何人都可以帮助我吗?我已经编写了代码,但它打开了一个新窗口https://www.google.co.in我想要隐藏该网址

我的代码是

 <apex:page controller="HiddenAddressBarController" sidebar="false" >
    <apex:pagemessages />
        <apex:form id="frm">
            <apex:pageblock title="Login Form" id="pgblck">
                <apex:pageblockSection id="pgblcksec">
                     <apex:outputLabel value="User Name : ">
                        <apex:inputtext value="{!UserName}" id="Usrn"/>
                    </apex:outputLabel>
                    <apex:outputLabel value="Password : ">
                        <apex:inputSecret value="{!Password}" id="Pwd"/>
                    </apex:outputLabel>
                </apex:pageblockSection>

                <apex:pageblockbuttons >
                     <!-- <apex:commandButton value="Login" action="{!loginMethod}"/> -->
                     <apex:commandButton value="Login" onclick="ValidateadnRedirect(); return false; "/> 
                    <!-- <apex:actionFunction name="ValidateandRedirect" action="{!loginMethod}"/>  -->
                </apex:pageblockbuttons>

            </apex:pageblock>
              <script type="text/javascript">
                function ValidateadnRedirect()
                {
                    <!-- alert('----'+document.getElementById("{!$Component.frm.pgblck.pgblcksec.Usrn}").value); -->
                    if(document.getElementById("{!$Component.frm.pgblck.pgblcksec.Usrn}").value=='')
                    {
                        alert('Please fill User Name');
                       // return false;
                    }
                    if(document.getElementById("{!$Component.frm.pgblck.pgblcksec.Pwd}").value=='')
                    {
                        alert('Please fill Password');
                        // return false;
                    }


                else
                {
                    window.open("https://www.google.com");
                }
        </script> 
    </apex:form>
  </apex:page>

1 个答案:

答案 0 :(得分:0)

将历史API与javascript一起使用

一个好的教程是here

您已经在使用javascript,所以只需拨打以下电话:

history.pushState(null,null,urluwant);

相关问题