Skip to content

Commit

Permalink
fix parse origin URL for Internet Explorer (#6)
Browse files Browse the repository at this point in the history
* html5 not supported

* replace parseUrl with getBaseUrl

* use getBaseUrl instead of parseUrl
  • Loading branch information
Michael Ruoss authored and pstadler committed Mar 27, 2018
1 parent d7e6867 commit 63ad8c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/LightBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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}
}
Expand Down
1 change: 0 additions & 1 deletion src/PaymentPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const PaymentPage = props => {
id='datatransPaymentFrame'
name='datatransPaymentFrame'
frameBorder={0}
allowTransparency={true}
/>
}

Expand Down
11 changes: 6 additions & 5 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down

0 comments on commit 63ad8c2

Please sign in to comment.