4

Its it possible to add things other than simple scripts or css to a visual force page ?

Examples:

<!--[if lte IE 8]>
    <script src="//cdnjs.cloudflare.com/ajax/libs/json2/20130526/json2.js"></script>
<![endif]-->

<base href="{!URLFOR($Resource.SalesCentralApp, 'SalesCentralApp/app/')}" />
<meta charset="utf-8"/>

I'm working with an angular app, and while chrome will actually detect the double head and combine the elements, IE 8 is not that smart...

1

Now, Visualforce has some very useful attributes to resolve these issues on apex:page tag. We can utilize them if building Angular app.

Refer the document apex:page tag.

On the apex page tag, provide attributes this way:

<apex:page docType="html-5.0" showheader="false" sidebar="false" standardstylesheets="false" applyHTMLTag="false" applyBodyTag="false">
  <html lang="en">
    <head>
        <meta charset="UTF-8"/>
        <meta name="viewport" content="width=device-width, initial-scale=1"/>
        <title>Example - example-guide-concepts-1-production</title>      
    </head>
    <body>
        <c:AngualarApp/>
    </body>
  </html>
</apex:page>

Above will be rendered as no conflict HTML:

<!DOCTYPE HTML>

  <html lang="en">
    <head>
        <script src="/static/111213/js/perf/stub.js" type="text/javascript"></script>
        <script src="/jslibrary/1466812160000/sfdc/VFMetadataSender.js" type="text/javascript"></script><meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE" />
        <meta HTTP-EQUIV="Expires" content="Mon, 01 Jan 1990 12:00:00 GMT" />

        <meta charset="UTF-8" />
        <meta content="width=device-width, initial-scale=1" name="viewport" />
        <title>Example - example-guide-concepts-1-production</title>      
    </head>
    <body>

    </body>
  </html>
  <script type="text/javascript">  SfdcApp.Visualforce.viewstate.ViewstateSender.sendViewstate('https://ashwaniarea-dev-ed.my.salesforce.com', 'NoDefaultHTMLTags');  </script>
| improve this answer | |
  • that only works if you don't need the app to show up with the Standard Salesforce header – NSjonas Aug 18 '16 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.