2017-08-15 27 views
-1

之後沒有反應,在iOS webapp中使用argelius' favorite star後,其js變得無響應。在桌面Safari瀏覽器中,它的作品,但給出了錯誤Refused to get unsafe header "Location",經過挖掘似乎是無關的,但我想我應該提到它。webapp在argelius的最愛明星

任何想法?

可能是我實現它的方式有問題,這是我實現的第一個GitHub存儲庫。

這個代碼是在<head>

<script src="https://argelius.github.io/favorite-star/bower_components/webcomponentsjs/webcomponents.js"></script> 
<link rel="import" href="https://argelius.github.io/favorite-star/favorite-star.html"> 

編輯:使用的是iOS網頁檢查後,我發現,scope.wrappers.Window回到null,進一步挖掘我發現這個解決方案:

變化:

function getDescriptor(source, name) { 
    try { 
    return Object.getOwnPropertyDescriptor(source, name); 
    } catch (ex) { 
    return dummyDescriptor; 
    } 
} 

作爲:

function getDescriptor(source, name) { 
    try { 
    var desc = Object.getOwnPropertyDescriptor(source, name); 
    if (desc) return desc; 
    } catch (ex) { 
    // Just return a dummy descriptor 
    } 
    return dummyDescriptor; 
} 

回答

0

使用的是iOS網頁檢查後我發現,scope.wrappers.Window回到null,進一步挖掘我發現這個解決方案:

變化:

function getDescriptor(source, name) { 
    try { 
    return Object.getOwnPropertyDescriptor(source, name); 
    } catch (ex) { 
    return dummyDescriptor; 
    } 
} 

爲:

function getDescriptor(source, name) { 
    try { 
    var desc = Object.getOwnPropertyDescriptor(source, name); 
    if (desc) return desc; 
    } catch (ex) { 
    // Just return a dummy descriptor 
    } 
    return dummyDescriptor; 
} 

信用:https://github.com/webcomponents/webcomponentsjs/issues/628

-1

按照安裝程序中https://github.com/argelius/favorite-star 和不使用位置「https://argelius.github.io/favorite-star/favorite-star.html」。

在您的本地環境中安裝它,然後添加favorite-star.html的本地路徑。

我與當地的環境試了一下 -

這裏是我的html代碼 -

<html> 
<head> 
<link rel="import" href="favorite-star/favorite-star.html"> 
</head> 
<body> 
    Hi!!! This is my favorite <favorite-star active></favorite-star> 
</body> 
</html> 

和提取的文件夾路徑是我的靜態資產文件夾,即公衆,然後路徑HREF提及。

+0

我想弄清楚,但我找到他們假設你知道這是如何工作的頁面...我如何使用nom或bower進行安裝? –

+0

你在當地的環境中是否有npm? –

+0

我不知道,我用eclipse編碼,並通過openshift託管我的網站。 –