Announcement

Collapse
No announcement yet.

Need help with vBulletin external.php integration

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help with vBulletin external.php integration

    I've been using the external feed with type Javascript for years to embed a feed onto the front page of my site. However, things have recently changed. For security, Apache is set to include the following header:
    Header set X-Content-Type-Options nosniff

    This works fine for Safari and Firefox, but Google Chrome now enforces strict mime types. In Chrome, it throws the following error:
    Refused to execute script from 'http://forum.miata.net/vb/external.php?type=js&forumids=82' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

    What other options do I have to get the feed to work in Chrome? I know I can set the feed to XML or RSS, but I don't know how to implement it in Javascript.

    Here's my current code:
    Code:
     
     <script type="text/javascript" src="http://forum.miata.net/vb/external.php?type=js&forumids=82"></script> <script language="" type="text/javascript"> <!-- for (i = 0; i < 8; i++) { document.writeln("<p>"+threads[i].threaddate+": <b>"+threads[i].title+"</b><br><a href=\"http://forum.miata.net/vb/showthread.php?threadid="+threads[i].threadid+"\">Read more...</a></p>"); } //--> </script>
    Here's a test page: http://www.miata.net/test.html Any suggestions on how to get a feed to work with Chrome?

  • #2
    For help with programming questions, please ask over at www.vbulletin.org, the modification and csutomization site.
    MARK.B | vBULLETIN SUPPORT

    TalkNewsUK - My vBulletin 5.3.1 Demo - FEATURING "ROUTE BY NODE"!
    AdminAmmo - My NEW Cloud Demo

    Comment


    • #3
      Hello,

      I gave your script a more "eye-friendly" format:

      Code:
      <script type="text/javascript" src="http://forum.miata.net/vb/external.php?type=js&forumids=82"></script>
      <script type="text/javascript">
      <!--
          for (i = 0; i < 8; i++){
              document.writeln(
                  "<p>
                      "+threads[i].threaddate+":
                      <b>"+threads[i].title+"</b>
                      <br />
                      <a href=\"http://forum.miata.net/vb/showthread.php?threadid="+threads[i].threadid+"\">Read more...</a>
                  </p>"
              );
          }
      //-->
      </script>
      Your problem is that you are using a <script> tag to load something that is an HTML page.
      My suggested solution is that you add this to your .htaccess file:

      Code:
      <IfModule mod_headers.c>
          Header always set X-Content-Type-Options nosniff
      </IfModule>

      Kind regards,
      George.
      Last edited by Set3sh; Mon 2nd Jan '17, 3:44am.

      Comment

      Working...
      X