javascript - How to manipulate history with history.go? -
function del_cookie(name) { document.cookie = name + '=; expires=thu, 01-jan-70 00:00:01 gmt;'; }
<!doctype html> <html lang="en"> <head> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="keywords" content="spanish chat, child abuse chat, child abuse support, child abuse discussion, suvivor, chat, discussion, support, domestic violence, violencia domestica, abuso infantil, abuso de niƱo"> <meta name="description" content="moderated chat rooms victims , survivors of child abuse , domestic violence."> <title>yes ican: international child advocacy network</title> <link href="css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="css/main.css"> <!--[if lt ie 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> <!-- <script type="text/javascript"> alert("safety alert: if in danger, please use safer computer, or call 911, local hotline, or u.s. national domestic violence hotline @ 1-800-799-7233 , tty 1-800-787-3224. see more technology safety tips online.") </script>--> </head> <body onload="initialize();"> <div id="wrapper"> <!--main navigation bar--> <nav class="navbar navbar-default"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span> </button> <a class="navbar-brand" href="index.html"><img alt="site logo" id="navlogo" src="img/logo_short_sm.png"/></a> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li class="active"><a data-toggle="tooltip" title="home page" target="_blank" href="index.html">home</a></li> <li><a data-toggle="tooltip" title="group facilitated chat room" href="gethelp.html">get help</a></li> <li><a data-toggle="tooltip" title="message board community" href="community-rules.html">community forums</a></li> <li><a data-toggle="tooltip" title="learn more abuse" href="aboutabuse.html">about abuse</a></li> <li><a data-toggle="tooltip" title="learn more yesican" href="about-us.html">about us</a></li> <li><a data-toggle="tooltip" title="opportunities volunteer, donate, , involved!" href="get-involved.html">get involved</a></li> </ul> <!--right side of navigation bar--> <ul class="nav navbar-nav navbar-right"> <li> <div class="btn btn-lg btn-danger donate-nav"><a target="_blank" href="https://donatenow.networkforgood.org/yesican?code=homepage">donate <span class="glyphicon glyphicon-heart" aria-hidden="true"></span></a></div> </li> </ul> </div> </div> </nav><!--end navigation--> <img id="banner" alt="home page banner" src="img/banner.jpg"/> <div id="content"> <section class="col-md-8"><!--left column content goes here--> <h2>our mission<small><br>working world wide stop silence , cycle of abuse</small></h2> <p>the international child advocacy network, inc. (yesican) leading global provider of online information have issues around child abuse. our mission work worldwide break silence , cycle of abuse. <strong><em>we</em> believe</strong> child abuse cease exist if had capability receive accurate, up-to-date information abuse , had capacity receive assistance , support change.</p> <h2>how make difference</h2> <p>our website provides information, statistics, , definitions of abuse. have <a href="community-rules.html"><em>yes</em>ican community</a> individuals have questions regarding child abuse , domestic violence can join others discuss various concerns , ideas around these topics.</p> <p>the premier service of our organization our <a href="chat-schedule.html">facilitated chat</a> groups. <strong>in these groups offer opportunity abused children , adults speak others , council , support trained facilitators.</strong> these facilitators have gone through 60-hour training lead licensed therapist. date, have had on 44,000 participants in our chat rooms. run specialized chat groups teens, adult-survivors, victims of domestic violence, individuals in close relationship abuse survivors , parents.</p> <h2>our current focus</h2> <p>our focus now, development of on-line parenting program. in 6-8 week program, individuals receive training in non-violent parenting. training include dynamics of both physical , emotional development, , appropriate discipline. in addition, each member of program have access support groups topic of each weeks' training session discussed. during time specific issues , concerns come each participant shared in safe , supportive environment.</p> <p>it our hope in future, provide international support forum, targeting military personnel , dependents based outside of united states.</p> </section> <section class="col-md-4" style="border-left:1px solid #cfd1d4;"><!--right column content goes here--> <div class="well"> <h2>april kickstarter</h2> <a href="https://www.kickstarter.com/projects/unbrokenangels/unbroken-angels" target="_blank"><img src="img/unbrokenkickstarterbutton.png"/></a> <p>please support , <a href="fundraiser.html">learn more about</a> our kickstarter running through april!</p> </div> <h2>in memorial</h2> <a href="memorial.html"><img alt="memorial list" src="img/memorial_list.jpg"/></a> <p>we keep <a href="memorial.html">this list in honor of children</a> have died injuries infliected upon them result of child abuse.</p> <h2>missing children<br><small>alert cases</small></h2> <section style="border: #cfd1d4 solid 1px; border-radius:2%; padding:10px;"> <!-- start feedwind code --><script type="text/javascript">document.write('\x3cscript type="text/javascript" src="' + ('https:' == document.location.protocol ? 'https://' : 'http://') + 'feed.mikle.com/js/rssmikle.js">\x3c/script>');</script><script type="text/javascript">(function() {var params = {rssmikle_url: "http://www.missingkids.com/missingkids/servlet/xmlservlet?act=rss&languagecountry=en_us&orgprefix=ncmc",rssmikle_frame_width: "100%",rssmikle_frame_height: "400",frame_height_by_article: "0",rssmikle_target: "_blank",rssmikle_font: "arial, helvetica, sans-serif",rssmikle_font_size: "12",rssmikle_border: "off",responsive: "off",rssmikle_css_url: "",text_align: "left",text_align2: "left",corner: "off",scrollbar: "on",autoscroll: "off",scrolldirection: "up",scrollstep: "2",mcspeed: "20",sort: "off",rssmikle_title: "off",rssmikle_title_sentence: "",rssmikle_title_link: "",rssmikle_title_bgcolor: "#ff0000",rssmikle_title_color: "#ffffff",rssmikle_title_bgimage: "",rssmikle_item_bgcolor: "#ffffff",rssmikle_item_bgimage: "",rssmikle_item_title_length: "55",rssmikle_item_title_color: "#0066ff",rssmikle_item_border_bottom: "on",rssmikle_item_description: "on",item_link: "off",rssmikle_item_description_length: "150",rssmikle_item_description_color: "#666666",rssmikle_item_date: "gl1",rssmikle_timezone: "etc/gmt",datetime_format: "%b %e, %y %l:%m:%s %p",item_description_style: "text+tn",item_thumbnail: "full",item_thumbnail_selection: "auto",article_num: "15",rssmikle_item_podcast: "off",keyword_inc: "",keyword_exc: ""};feedwind_show_widget_iframe(params);})();</script><div style="font-size:10px; text-align:center; width:300px;"><a href="http://feed.mikle.com/" target="_blank" style="color:#cccccc;">rss feed widget</a><!--please display above link in web page according terms of service.--></div><!-- end feedwind code --></section> </section> </div> <div class="container" style="overflow-y: hidden;"> <div class="modal fade" id="mymodal"> <div class="modal-dialog modal-md custom-height-modal"> <div class="modal-content"> <div class="modal-header" style="background-color:#d3d3d3"> <button type="button" class="close" data-dismiss="modal">×</button> <h3 class="modal-title" style="text-align:center">safety warning</h3> </div> <div class="modal-body"> <p style="text-align:center"> computer can monitored others. safety, consider using public computer or friend’s computer. if in danger, please call 911, local hotline, or u.s. national domestic violence hotline at<a href="tel:+1.800.799.7233" class="call" onclick="return probablyphone;"> +1-800-799-7233</a> , <br> tty <a href="tel:+1.800.787.3224" class="call" onclick="return probablyphone;">+1-800-787-3224</a>.</p> <p style="text-align:center"> learn more how computer safety, click following link: <br><a href="internet-safety-tips.html">internet safety tips</a></br></p> <!--wording can better meantime--> <p style="text-align:center"> if not safe, click following button: <br><span class="btn btn-lg btn-danger" id="get-away" id="del_cookie">escape button</span></br></p> </div> <div class="modal-footer"> <p class="text-center"><a href="" class="btn btn-default" class="btn pull-middle" data-dismiss="modal" >close</a></p> </div> </div> </div> </div> </div><!--end of modal container--> <!--<div class="container"> <section class="col-md-3"> <div class="list-group" id="sidebar"> <a href="#" class="list-group-item"> link 1 </a> </div> </section> </div>--> </div><!--end wrapper--> <footer> <div id="footer-right"> <ul> <li>about us</li> <li><a href="contact.html">contact us</a></li> <li><a href="faq.html">faq's</a></li> <li><a href="sitemap.html">site map</a></li> </ul> <ul> <li>support our cause</li> <li><a href="https://donatenow.networkforgood.org/yesican?code=homepage" target="_blank">donate</a></li> <li><a href="volunteer.html">volunteer</a></li> <li><a href="fundraiser.html">fundraising events</a></li> </ul> <ul> <li>follow us</li> <li> <a target="_blank" href="http://ww.facebook.com/yesicanorg"><img src="img/social/facebook-icon.png" alt="facebook logo" class="social-icon"></a> <a target="_blank" href="http://www.instagram.com/childadvocacynetwork"><img src="img/social/instagram-icon.png" alt="instagram logo" class="social-icon"></a> <a target="_blank" href="http://twitter.com/yesicanorg"><img src="img/social/twitter-icon.png" alt="twitter logo" class="social-icon"/></a> <a target="_blank" href="http://www.pinterest.com/yesicanorg"><img src="img/social/pinterest-icon.png" alt="pinterest logo" class="social-icon"/></a> <a target="_blank" href="http://www.youtube.com/childadvocacynetwork"><img src="img/social/youtube-icon.png" alt="youtube logo" class="social-icon"/></a> </li> </ul> </div> <div id="footer-left"> <p id="footer-slogan">break <strong>silence</strong> <br>and <strong>cycle</strong> of abuse</p> <p id="copyright">copyright© 2015 international child advocacy network</p> </div> </footer> <!-- bootstrap core javascript placed @ end of document pages load faster --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script> <!--<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>--> <script src="js/bootstrap.min.js"></script> <script src="/path/to/jquery.cookie.js"></script> <script src="js/escape-button.js"></script> <script src="js/history.replace.js"></script> <!--testing see if works--> <!--<script> $(document).ready(function() { if ($.cookie('pop') == null) { $('#mymodal').modal('show'); $.cookie('pop', '1'); } }); </script>--> <!--works fine--> <script type="text/javascript"> $(function(){ $( '#mymodal' ).modal('show'); }); </script> <script> var probablyphone = ((/iphone|android|ie|blackberry|fennec/).test(navigator.useragent.tolowercase()) && 'ontouchstart' in document.documentelement); function initialize() { ( function( $ ) { $( '.call' ).css ( "text-decoration", "none" ); $( '.call' ).css ( "color", "black" ); $( '.call' ).css ( "cursor", "default" ); } )( jquery ); } </script> </body> </html>
i doing website abuse survivors , have created escape button jump user link , replace location of site site google. trying figure out how manipulate history button. currently, have code not working @ when button or arrow clicked on. also, best approach replace/erase cookies when user visits website.
function getaway() { // away right window.open("http://weather.com", "_newtab"); // replace current site benign site window.location.replace('http://google.com'); // should clear button history. var backlen = history.length; history.go(-2); } $(function() { $("#get-away").on("click", function(e) { getaway(); }); $("#get-away a").on("click", function(e) { // allow (?) link work e.stoppropagation(); }); });