外部网站无法在iFrame中加载cordova

时间:2016-01-07 21:30:33

标签: cordova

在我使用phonegap / cordova CLI构建的Android应用程序中,我有一个Iframe加载外部网站。到目前为止这个工作正常,自上周以来突然停止了。在我的配置文件中我有

<plugin name="cordova-plugin-whitelist" version="1" />

我将meta标记放在index.html中:

<meta http-equiv="Content-Security-Policy" content="default-src *;
style-src * 'unsafe-inline'; script-src * 'unsafe-inline'; media-src *">

cordova-plugin-whitelist中导致此问题的变化是什么?

1 个答案:

答案 0 :(得分:1)

您还应该在元标记中添加框架定义,如下所示:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from _pybgpstream import BGPStream, BGPRecord, BGPElem
from collections import defaultdict
import time
import datetime
import os
import MySQLdb

db = MySQLdb.connect(user="bgpstream", host="localhost",   passwd="Bgpstream9", db="bgpstream_copy")
db_cursor = db.cursor()

# Create a new bgpstream instance and a reusable bgprecord instance
stream = BGPStream()    
rec = BGPRecord()

# Consider Route Views origon only
collector_name = 'rrc11'
stream.add_filter('collector',collector_name)   #maybe we want route-views4?

t_end = int(time.time())    #current time now   
t_start = t_end-3600 #the time interval (duration) we are getting    from collecor, e.i 60*60 = 3600s = 1 hour
stream.add_interval_filter(t_start,t_end)
print "Total duration " + str(t_end-t_start) + " sec"

# Start the stream
stream.start()

### Insert loop ###
# This loop insert new records and tries not to over count the records
# Get next record:
while(stream.get_next_record(rec)):
    # Print the record information only if it is not a valid record
    if rec.status != "valid":
        print rec.project, rec.collector, rec.type, rec.time, rec.status
    else:

        # Skip if rib
        if rec.type == "rib":
            continue

        #get affected rows from insert
        affected_rows = db.affected_rows()

        # Skip if dulpicate record 
        if affected_rows <= 0:
            continue

        # Extract insert id of last inserted bgp record
        last_record_id = db.insert_id()

        print last_record_id

        # Traverse elements
        elem = rec.get_next_elem()
        while(elem):

            print last_record_id

            ## Dette bør kaste en exeption
            if elem == None:
                continue

            # Insert element
            db_cursor.execute(
            """INSERT INTO bgp_elements
            (record_id_owner, element_time, peer_address, peer_asn) 
            VALUES 
            (
            '"""+str(last_record_id)+"""',
            '"""+str(elem.time)+"""',
            '"""+str(elem.peer_address)+"""',
            '"""+str(elem.peer_asn)+"""'
            ) 
            """)            
            elem = rec.get_next_elem()

请注意使用通配符并不安全。 您还应该在config.xml cordova文件中添加以下元标记:

String sampleString = "ANL\File\05003ede-59bf-45c6-bb57-a6111e9f18e0\linux-cheat-sheet.pdf"";
String[] stringArray = sampleString.split("\");
String wantedString = stringArray[0];