Frage

I need to block back button in browser. i know html code but i want it in haml

Can anyone convert this html code into haml code:

<HTML>
    <HEAD>
        <SCRIPT type="text/javascript">    
             window.history.forward();
             function noBack() { 
                  window.history.forward(); 
             }
        </SCRIPT>
    </HEAD>
    <BODY onload="noBack();" onpageshow="if (event.persisted) noBack();" onunload="">
        <a href="new1.html"> new1 </a>
        <a href="new2.html"> new2 </a>
    </BODY>
</HTML>
War es hilfreich?

Lösung

http://html2haml.heroku.com/

%html
  %head
    :javascript
      window.history.forward();
      function noBack() { 
           window.history.forward(); 
      }
  %body{:onload => "noBack();", :onpageshow => "if (event.persisted) noBack();", :onunload => ""}
    %a{:href => "new1.html"} new1
    %a{:href => "new2.html"} new2

Andere Tipps

I created an updated HTML/ERB converter at: http://haml.io/

It's open source if anyone wants to contribute and help make it better. It's still based off the great Html2haml gem.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top