mirror of https://github.com/vitalif/phantomjs
Adding "--local-access-remote=[yes|no]".
* This will allow local content to access remote content, bypassing the same origin policy. * It's controllable from the CLI and through the "page.settings" property * This addresses Issue #28 but only partially: it's still not possible to make _remote content access other remote content on a different origin_.1.3
parent
addcb36a2e
commit
64404a1902
|
@ -64,6 +64,7 @@ class Phantom(QObject):
|
|||
self.m_defaultPageSettings['loadImages'] = args.load_images
|
||||
self.m_defaultPageSettings['loadPlugins'] = args.load_plugins
|
||||
self.m_defaultPageSettings['userAgent'] = self.m_page.userAgent()
|
||||
self.m_defaultPageSettings['localAccessRemote'] = args.local_access_remote
|
||||
self.m_page.applySettings(self.m_defaultPageSettings)
|
||||
|
||||
self.libraryPath = os.path.dirname(os.path.abspath(self.m_scriptFile))
|
||||
|
|
|
@ -60,6 +60,7 @@ def parseArgs(args):
|
|||
args.ignore_ssl_errors = False if args.ignore_ssl_errors == 'no' else True
|
||||
args.load_images = True if args.load_images == 'yes' else False
|
||||
args.load_plugins = False if args.load_plugins == 'no' else True
|
||||
args.local_access_remote = False if args.local_access_remote == 'no' else True
|
||||
|
||||
if args.proxy:
|
||||
item = args.proxy.split(':')
|
||||
|
|
|
@ -79,6 +79,10 @@ def argParser():
|
|||
choices=['yes', 'no'],
|
||||
help='Load all plugins (i.e. Flash, Silverlight, ...) (default: %(default)s)'
|
||||
)
|
||||
parser.add_argument('--local-access-remote', default='no',
|
||||
choices=['yes', 'no'],
|
||||
help='Local content can access remote URL (default: %(default)s)'
|
||||
)
|
||||
parser.add_argument('--proxy', metavar='address:port',
|
||||
help='Set the network proxy'
|
||||
)
|
||||
|
|
|
@ -117,6 +117,7 @@ class WebPage(QObject):
|
|||
|
||||
opt.setAttribute(QWebSettings.AutoLoadImages, defaults['loadImages'])
|
||||
opt.setAttribute(QWebSettings.PluginsEnabled, defaults['loadPlugins'])
|
||||
opt.setAttribute(QWebSettings.LocalContentCanAccessRemoteUrls, defaults['localAccessRemote'])
|
||||
if 'userAgent' in defaults:
|
||||
self.m_webPage.m_userAgent = defaults['userAgent']
|
||||
|
||||
|
|
Loading…
Reference in New Issue