Changes

Jump to navigation Jump to search

Embedded Iframe

5,385 bytes added, 08:20, 7 June 2022
[[Category:Widgets]]
[[Category:Troubleshooting]]
<div class="heading">Embedded IframeiFrame Generator</div> This page is about the menu {{#fas:cog}} (SETTINGS) BOOKING ENGINE > BOOKING WIDGETS > IFRAME iFrame GENERATOR and explains how to embed the booking page into a web site.  <span style=Generate Code Snippet"color: #f3e504; font-size: 150%;" >{{#fas:lightbulb}} </span> Using iFrames are convenient but may have a sub optimal usability experience. Consider opening the booking page in a new tab instead of embedding it in an iFrame. =Using an iFrame=Set Ising iFrames are convenient but may have a sub optimal usability experience. Consider opening the booking page in a new tab instead of embedding it in an iFrame. If you want to use an iFrame set the your parameters in the Iframe iFrame Generator then click on "Get Code". Paste this code into the source code of your website.
<span style="color: #f3e504; font-size: 250%;" >{{#fas:lightbulb}} </span> Do not change the default settings for "Opening Checkin Date", "Length of Stay" and "Number of Guests" if you want to redirect from a widget to an embedded booking page.
 
==How to reliably transfer dates and other data from a booking widget on one page to a booking page embedded in an Frame on a different page==
If you do want to use an iFrame, our booking widgets can pass dates to it by first opening the booking page directly in the browser and immediately redirecting to the page with the same booking page embedded in an iFrame. This is generally invisible to the visitor and allows setting a cookie to create a session and pass data from one to the other.
 
In recent times browser security and privacy concerns have led to more blocking of third party cookies which can also block our ability to pass data from the widget to the iFrame.
 
Consider opening the booking page in a new tab instead of embedding it in an iFrame.
 
If you do want to use an iFrame you can use following method to overcome the issue:
 
If you do want to use an iFrame you can use following method to overcome the issue. This solution passes the widget data directly to the page holding the iFrame and relies on a special script installed on the page to pass the parameters to the iFrame. The iFrame then loads the booking page with the data from the widget.
 
This avoids the use of cookies to pass the data and should not be blocked by security or privacy settings.
 
<span style="color:#fe746c;“ >{{#fas:exclamation-triangle}} </span>The solution requires that your website can have additional parameters added to your page URL without affecting their ability to load.
 
The principle here is to open your URL containing the iFrame directly with the booking page parameters added to your URL after a ?. The supplied script installed on your page will pass these URL parameters through to the iFrame which will apply them to the booking page within the iFrame.
 
'''Step 1: Customize the widget'''
 
Go to {{#fas:cog}} (SETTINGS) BOOKING ENGINE > BOOKING WIDGETS
*Set the value of the “formAction” parameter to be the full URL of the page containing the iFrame. This will cause the booking widget to take the visitor directly to the page with the iFrame and will add the data from the booking widget to the URL as additional parameters
*Customize the widget according to your requirements
*Make sure the "Redirect URL" field is blank
*SAVE
 
'''Step 2: Install the widget on your website'''
*Click on "Get Code"
*Copy the code and paste into the HTML of your website where you want show the widget
 
'''Step 3: Customize the iFrame'''
 
Go to {{#fas:cog}} (SETTINGS) BOOKING ENGINE > BOOKING WIDGETS > EMBEDDED iFrame and set
*"Opening Checkin Date" = Default
*"Length of Stay " = Default
*"Length of Stay" = Default
*SAVE
 
'''Step 4: Generate and modify the iFrame snippet'''
 
*Click on "Get Code"
*Copy the code
*Change the element src to be called data-src and leave the URL the same. There should be no scr in the iFrame, the script will add it.
 
 
 
'''Step 5: Install the iFrame and script on your website'''
*Paste the modified code snipped into the HTML of your website where you want show the iFrame
*Add the following script directly after the iFrame end tag </iFrame>
 
 
Example:
<div style="background-color: #f8f9fa !important; border: 1px solid #eaecf0;border-radius: 2px; padding: 1px 4px;">
<span style="background-color: #f8f9fa; border: 1px solid #eaecf0;border-radius: 2px; padding: 1px 4px;"><nowiki><iFrame data-src="https://beds24.com/booking2.php?propid=12345&amp;referer=iFrame" width="800" height="2000" style="max-width:100%;border:none;overflow:auto;"><p><a href="https://beds24.com/booking2.php?propid=12345&amp;referer=iFrame" title="Book Now">Book Now</a></p></iFrame></nowiki></span>
 
 
<script>
<nowiki>
var addUrlParamsToIframeSrcs = function() { const validParameters = ["checkin", "checkout", "numnight", "numadult", "numchild", "ownerid", "propid", "roomid", "referer", "redirect", "lang", "group", "nogroup", "category1", "category2", "category3", "category4", "customParameter"]; const currentUrl = new URL(window.location.href); let parametersString = ""; validParameters.forEach(parameter => { const parameterValue = currentUrl.searchParams.get(parameter); if (parameterValue !== null) { parametersString += "&" + parameter + "=" + parameterValue; } }); const iframes = document.getElementsByTagName("iframe"); for (let iframe of iframes) { let iframeSrc = iframe.getAttribute("data-src"); if (iframeSrc === null) { continue; } if (!iframeSrc.includes("?")) { iframeSrc += "?"; } iframeSrc += parametersString; iframe.setAttribute("src", iframeSrc) } }; addUrlParamsToIframeSrcs();
</nowiki>
</script>
</div>
=Wordpress=
=Multiple Properties=
Set "Properties" = All to create a booking an Iframe iFrame Code for a multiple property booking page. The multiple property booking page.
When a guest clicks on "Book" for one of the listed properties they will be taken to the property booking page where they can book.
If you you have embedded property booking pages as well and want to redirect the guest to this page go to {{#fas:cog}} (SETTINGS) BOOKING ENGINE > BOOKING PAGE > BEHAVIOUR and set "Booking Redirect" = "Multiple Property Only" and enter the URL of the property booking page followed by the redirect destination in "Booking Redirect Url" like this:
<code><nowiki> https://beds24.com/booking.php?propid=12341&redirect=https://www.mywebsite/propertyA</nowiki></code>
=Developer Options=
Developers can create a custom landing page after the booking. The setting is {{#fas:cog}} (SETTINGS) BOOKING ENGINE > PROPERTY BOOKING PAGE > BEHAVIOUR "Booking Return URL". Information about the booking is passed to your page as URL parameters which you could extract and display on your page.
Visit this help page for more [[:category:developers|developer options]].
==Scrollbar ==
There are two possible reasons for a scrollbar to appear:
1. The Iframe iFrame has not enough height for the content. Raise the value in the <code>height</code> parameter in the booking. For example in this link the height is 1500 (height="1500"):
<code><nowiki><iframe iFrame style="max-width: 100%; border: none; overflow: auto;" src="https://www.beds24.com/booking2.php?propid=3103&amp;numdisplayed=5&amp;numnight=1&amp;numadult=2-1&amp;referer=iframeiFrame/" height="1500" width="800"></iframeiFrame></nowiki></code>
2. The container on your website which holds the Iframe iFrame does not have enough height.
==Dates and/or numbers of guests do not transport from widget ==
This happens when you specify the dates and/or number of guests in the URL. Remove the <code>numadult</code> and <code>advancedays</code> and parameters from the URL of the IframeiFrame.
Also make sure that the widget has the same options guest selection as the booking page.
<span style="color:#fe746c;“ >{{#fas:exclamation-triangle}} </span> If you allow guests to book multiple rooms on your booking page the number of guests will never transport from the widget.
==Scroll Iframe iFrame to the top ==When a long page inside an Iframe iFrame changes to a shorter page, the guest viewing the page might be left at the bottom looking at what appears to be a blank page.Possibilities to access and control the Iframe iFrame from outside (your website) are limited.
Try adding onload="window.parent.parent.scrollTo(0,0)" to the IframeiFrame. For example:
<code><nowiki><iframe iFrame onload="window.parent.parent.scrollTo(0,0)" style="max-width: 100%; border: none; overflow: auto;" src="https://www.beds24.com/booking2.php?propid=3103&amp;numdisplayed=5&amp;numnight=1&amp;numadult=2-1&amp;referer=iframeiFrame/" height="1500" width="800"></iframeiFrame></nowiki></code>
*Reduce the height of the embedded booking page or the IframeiFrame. Keeping the Iframe iFrame small and allowing scroll bars to navigate inside it can work well.
==Page is insecure==
==Bottom of the page is blank==
When a long page inside an Iframe iFrame changes to a shorter page, the guest viewing the page might be left at the bottom looking at what appears to be a <b>blank page</b>. [[Scroll_Iframe_to_the_top_of_the_pageScroll_iFrame_to_the_top_of_the_page|Read this help document]] to learn about solutions for this problem.
==Display problems on mobile==
If content is cut off you most likely have not enough width or height in the holding container. Increase either the width and height or try using a smaller font size.
Iframes iFrames on mobile devices are problematic. Make sure you have following code in the <head>: <meta name="viewport" content="width=device-width, initial-scale=1">. If you use the booking page in an Iframe iFrame we recommend you set up a special mobile page for the page where you have embedded the Iframe iFrame which opens the booking page in a new page instead of an IframeiFrame==Google Map not showing==Make sure you have:*Entered your Google Maps API key in {{#fas:cog}} (SETTINGS) > BOOKING ENGINE > PROPERTY BOOKING PAGE > DEVELOPERS*Allowed access from your URL with the API Key (needs to be set in Google Cloud Platform)*Activate the "Maps JavaScript API" in Google (which is the one for embedding maps to websites)*Enabled billing in Google
2,819

edits

Navigation menu