我需要阻止浏览器中的后退按钮。我知道 html 代码,但我想要它在 haml 中
任何人都可以将此 html 代码转换为 haml 代码吗:
<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>
最佳答案
%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
关于ruby - 将 HTML 转换为 HAML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17059926/