From 63ad8c260fad35c64c2b358d324ee00dfb1d3164 Mon Sep 17 00:00:00 2001 From: Michael Ruoss Date: Tue, 27 Mar 2018 09:43:41 +0200 Subject: [PATCH] fix parse origin URL for Internet Explorer (#6) * html5 not supported * replace parseUrl with getBaseUrl * use getBaseUrl instead of parseUrl --- src/LightBox.js | 4 ++-- src/PaymentPage.js | 1 - src/utils.js | 11 ++++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/LightBox.js b/src/LightBox.js index 0d362a8..b8aaf84 100644 --- a/src/LightBox.js +++ b/src/LightBox.js @@ -2,7 +2,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import PaymentPageFrame from './PaymentPageFrame' import { - filterProps, toUrlParams, parseUrl, + filterProps, toUrlParams, getBaseUrl, lockScrolling, releaseLock } from './utils' @@ -31,7 +31,7 @@ export default class LightBox extends Component { const urlParams = filterProps(this.props, rejectProps) this.url = buildUrl(urlParams, this.props.production) - this.origin = parseUrl(this.url).origin + this.origin = getBaseUrl(this.url) this.state = { visible: true} } diff --git a/src/PaymentPage.js b/src/PaymentPage.js index 10b2294..c651227 100644 --- a/src/PaymentPage.js +++ b/src/PaymentPage.js @@ -10,7 +10,6 @@ const PaymentPage = props => { id='datatransPaymentFrame' name='datatransPaymentFrame' frameBorder={0} - allowTransparency={true} /> } diff --git a/src/utils.js b/src/utils.js index 4db2e2a..33f4bc4 100644 --- a/src/utils.js +++ b/src/utils.js @@ -14,15 +14,16 @@ export const set = (target, key, value) => { target[key] = value return target } + export const toUrlParams = props => Object.keys(props) .map(key => `${key}=${props[key]}`) .join('&') - -export const parseUrl = url => { - const a = document.createElement('a') - a.href = url - return a +export const getBaseUrl = url => { + const pathArray = url.split('/') + const protocol = pathArray[0] + const host = pathArray[2] + return protocol + '//' + host } export const lockScrolling = () => {