[Javascript] Need Javascript logic for going to homepage if theprevious history not available

Rajaram Sahasranaman rajarsn at gmail.com
Mon Sep 1 02:55:14 CDT 2008


Thanks. When I used Window.location.href = url after checking
window.history.length=0, it worked correctly. If there is no history
avaialble, the application redirects the user to the homepage. if history is
available, it will execute accordingly.

Thanks a lot for your reply.

On Sat, Aug 30, 2008 at 4:33 PM, (Margaret) Michele Waldman <
mmwaldman at optonline.net> wrote:

> I'm not sure what your looking for here.
>
> To go to the home page use
>
> Window.location = url
>
> Michele
>
> -----Original Message-----
> From: javascript-bounces at lists.evolt.org
> [mailto:javascript-bounces at lists.evolt.org] On Behalf Of Rajaram
> Sahasranaman
> Sent: Friday, August 29, 2008 10:39 PM
> To: javascript at lists.evolt.org
> Subject: [Javascript] Need Javascript logic for going to homepage if
> theprevious history not available
>
>
>
>  undefined
>  undefined
>        evolt.org
>
>
> Hi,
>
> In my aspx page, I have two tabs. I have written a javascript in such a way
> that if the user clicks on first tab, it will go to the previous page
> visited and that will be the required behaviour which is working perfectly
> fine.
>
> Sometimes the previous history will not be available. In the sense, there
> is
> an option that the user can directly visit the page by making changes in
> the
> url without going to login and home page. In such a case, I need to show
> the
> user the home page. How will I do that? Can anybody provides any logic to
> me
> for this?
>
> I have used the following JS code for going to previous page.
> function UltraWebTabMain_Click(oWebTab,oTab,oEvent)
> {
> var wTab = igtab_getTabById("ctl00_TabControl1_UltraWebTab1");
> if(wTab!=null)
> {
> var tab = wTab.getSelectedTab();
> if(tab!=null)
> {
> var tabtext = tab.getText();
> var FirstTab = 0;
> if ((oTab.Key == "Search") && (tabtext != "Search"))
> {
> window.history.go(-1);
> wTab.setSelectedIndex(FirstTab);
>
> }
>
> }
> }
> }
>
> Can I do any modification to the above JS code so that the user should be
> directed to Home Page if history not present? Can anybody provide any help
> please?
>
> Thanks
> Meeram395[image: Smile]
> _______________________________________________
> Javascript mailing list
> Javascript at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/javascript
>
> _______________________________________________
> Javascript mailing list
> Javascript at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/javascript
>



More information about the Javascript mailing list