Thursday, 15 July 2010

javascript - How do I change URL without reloading page? - WITH A TWIST -



javascript - How do I change URL without reloading page? - WITH A TWIST -

i looking remove amount of page url without reloading.

i have looked on stackoverflow reply , there few close answers not i'm looking really.

i not want utilize hash function , if possible, avoid using html5 version because html5 isn't ratified standard yet , website used on, wouldn't @ surprised of clients used ie6.

i prefer if wasn't extremely complicated solution 400 lines of code (at cost i'd rather reload page honest).

i forgot mention this, critical, part of question

the user directed different page string via php. example: user submits form errors. let's form on /myform.php user gets headed /index.php?string

carry on normal

what have:

this illustration url wish edit without reloading:

http://www.mywebsite.com/index.php?string

wait! ?string has utilize on /index.php

index.php utilize $_get['string']; , display message user

i have used jquery remove message after 4 seconds this:

<div id="pagemsg"><?php echo $string; ?></div> <script language="javascript"> settimeout( "$('#pagemsg').fadeout();", 4000); </script>

this works , message disappears after 4 seconds. i'm left url:

http://www.mywebsite.com/index.php?string

i don't want string anymore because ?string has done job!

i remove ?string without reloading while page.

is there solution can help me?

also,

i don't mind if have utilize html5 force function there fall-back solution browsers don;t back upwards html5?

why did set twist in title? well, requirements different questions have seen far. right me if i'm wrong , alter it.

thanks help in advance!

the simple reply no. that's why added pushstate.

however, looks trying accomplish mutual scenario known flash messaging. done using user's session store message show on next request (and delete it).

example:

function doimportstuff() { // ... $_session['message'] = 'important stuff done'; // ... } function showboringpage() { // ... if (isset($_session['message']) { echo '<b>' . $_session['message'] . '</b>'; unset($_session['message']); } // ... }

javascript php jquery html5 redirect

No comments:

Post a Comment