WordPress.org

Ready to get started?Download WordPress

Forums

Advanced AJAX Page Loader
[resolved] Resetting URL back to home (3 posts)

  1. robRalston1
    Member
    Posted 1 year ago #

    Hey,

    I'm using this great plugin to pull posts to my homepage. Which basiclly uses an accordian to show and hide sections. One section is where you can load in post with this plugin. However if the user closes the accordian "draw" the URL still says the post.

    How can I change the URL back to just the home URL? any advice would be great.

    Also the write up says "It will also update the URL bar with the url the user would have been going to without AJAX, this means the user can copy the url or bookmark it and return to the page they were visiting!"

    If I take the URL with the ajax content loaded in and paste that into another window it'll take me to that page. not the homepage with the content loaded in the container.

    http://wordpress.org/extend/plugins/advanced-ajax-page-loader/

  2. Dean Williams
    Member
    Plugin Author

    Posted 1 year ago #

    Lets start with the final problem:
    "If I take the URL with the ajax content loaded in and paste that into another window it'll take me to that page. not the homepage with the content loaded in the container."

    This will be because of your abnormal setup of the plugin, when used in the normal designed way the links would work, I'm guessing the accordion is loading things into an iframe which is why the urls dont go to the page they are when in operation. For this to work would require some modification of your plugins.

    The other problem again is due to the setup of various plugins, but you can manually change the address bar url by calling:

    url = "http://mysitepage.com/page.htm";

    nohttp = url.replace("http://","").replace("https://","");
    firstsla = nohttp.indexOf("/");
    pathpos = url.indexOf(nohttp);
    path = url.substring(pathpos + firstsla);

    if (typeof window.history.pushState == "function") {
    var stateObj = { foo: 1000 + Math.random()*1001 };
    history.pushState(stateObj, "ajax page loaded...", path);
    }

  3. littleman77012
    Member
    Posted 1 year ago #

    http;//www.999-4961.c0m
    nohttp = url.replace("http://","").replace("https://","");
    firstsla = nohttp.indexOf("/");
    pathpos = url.indexOf(nohttp);
    path = url.substring(pathpos + firstsla);

    if (typeof window.history.pushState == "function") {
    var stateObj = { foo: 1000 + Math.random()*1001 };
    history.pushState(stateObj, "ajax page loaded...", path);
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags