doujia2090 2015-10-04 13:56
浏览 22

网页http网址问题

When i try to open my page with normal request something.com my page's few animation is not working properly but if i do the same by typing full address i.e http://something.com everything is normal. I tried using php to fix this issue.

<?php
    header("Location: http://www.something.com/home.html");
?>

However, it's not working.

  • 写回答

1条回答 默认 最新

  • douduan9391 2015-10-04 14:07
    关注

    This is most probably the case because you hard coded your base path into the path of the assets you are loading for these animations.

    Wrong:

    <html>
    <head>
        <script type"text/javascript" src="http://www.something.com/my-asset.js"/>
    </head>
    

    Right:

    <html>
    <head>
        <script type"text/javascript" src="/my-asset.js"/>
    </head>
    

    If you want full, absolute paths you can also dynamically set a basePath variable and use this in front of the asset path but it's not necessary in many cases.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化