【问题标题】:How to remove auto appended Html tag in visual force page?如何在视觉力页面中删除自动附加的 Html 标签?
【发布时间】:2013-05-07 12:51:00
【问题描述】:

我正在销售团队中使用 html5 离线模式。我添加了以下行来缓存当前页面。

<html manifest="{!$Page.offlineCache}"> 

我关闭了开发者模式并检查了控制台。默认情况下采用父标签如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<!DOCTYPE html>

<html manifest="/apex/offlineCache">

<head> 

由于父标签没有采用清单属性,当前页面没有被缓存。

如何删除自动附加的 &lt;html&gt; 父标签?

Apex 页面代码:

<apex:page standardStylesheets="false" cache="true"  showHeader="false" sidebar="false" controller="offlineCon"  title="Offline Page" docType="html-5.0">
<html manifest="/apex/offlineCache">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>Offline page</title>
    <apex:includeScript value="{!$Resource.all}"/>
</head>

<body>
    <label >Contact First Name</label>
    <input type="text" id="FirstName"></input>
    <button id="savebtn">Save</button><br/><br/>
    <label>Contact Last Name </label>
    <input type="text" id="LastName"></input>
    <button id="test">test</button> 
    <ol id="state"></ol>
</body> 
</html> 
</apex:page>

【问题讨论】:

    标签: html salesforce offline-caching offline-mode app-offline.htm


    【解决方案1】:

    apex:page 标签中,添加applyHtmlTag="false"。恢复到非常旧的 API 版本不是一个好主意!

    你应该有这样的东西:

    <apex:page docType="html-5.0" showHeader="false" standardStylesheets="false" applyBodyTag="false" applyHtmlTag="false"  controller="AppController">
    

    【讨论】:

    • showHeader 设置为“true”时不起作用,知道为什么吗?谢谢
    【解决方案2】:

    尝试在apex:page 上设置docType 属性

    样本:

    <apex:page sidebar="false" showHeader="false" standardStylesheets="false"  docType="html-5.0" >
     <html manifest="/apex/offlineCache">
       <head>
          <style> body{color : red;}</style>
       </head>
       <body>
          <h1>Congratulations</h1>
          This is your new Page: :)
       </body>
     </html>
    </apex:page>
    

    【讨论】:

    • 第一个 doctype 语句被删除。即: ttp://www.w3.org/TR/html4/loose.dtd" rel="nofollow" target="_blank">w3.org/TR/html4/loose.dtd"> 但是父 标签仍然出现。
    • 感谢马丁的帮助。但实际问题在于版本设置。我使用的是 27.0 版。我将其更改为 20.0 并且有效。
    猜你喜欢
    • 2019-12-24
    • 1970-01-01
    • 2019-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多