Is there alternative way to JavascriptInterface of Webview on Chrome Custom Tabs? - chrome-custom-tabs

I am using JavascriptInterface of Webview.
Is it possible on Chrome Custom Tabs?
Or
Is there alternative method of that?

No. CustomTabs do not allow apps to interact with web page contents for privacy reasons. Though you can measure how fast the pages load with CustomTabsCallback.

Related

Disable DFP iframes to acces parent window

I am having some troubles with malicious ads that show interstitials with no close button.
Inspecting the code, I found that DFP uses <iframe> tags to load the ads, but as the content of those iframes are loaded using Javascript (using iframe's document.write(), without src attribute), they get full access to parent window through window.top and window.top.document, allowing advertisers to inject code, show malicious ads and even stole data such as user emails and passwords.
In order to prevent this, I'm looking for a way to block DFP ads to access the main window. Is it possible?
Consider using SafeFrames rather than Friendly Iframes you appear to be using. Quoting from DFP's help page on the subject:
We recommend using SafeFrames and creatives compatible with SafeFrame for expansion instead of friendly iframes. SafeFrame is supported in DFP and enabled by default when using GPT tags. It enables transparent and rich interactions between page content and ads, while preventing external access to sensitive data and providing more granular control over which creatives are rendered
I think you use synchronous rendering, try to change it to asynchronous
https://support.google.com/dfp_premium/answer/183282?hl=en

Options for creating custom dialogs in Sitecore

I need to implement some pop-up dialogs in sitecore. The popups are used in an existing angular site and I would like to reuse as much as possible.
Use case: From a sitecore form activate the dialog, init the dialog with data from the sitecore field. If the user presses OK, then write back the new value to the site core field.
I know that sitecore has an IFrame type but I know that the browser will not allow me to write back to the parent window from a site in another domain.
So what options do I have?
It is possible to communicate cross iframes and cross domains by posting it between, see example here

Can I submit a form with google's recaptcha in it from my app?

I'm writing an app which involves letting users to share comments on a website, which has a comment form with Google's reCAPTCHA embeded. I would like to load this page via HTTP and display CAPTCHA within my app, so that user can post comments from my app. Is it easy to implement or should I rather try other solution?
EDIT:
I've red reCAPTCHA developer guide. If I would like to embed captcha inside my form, I'd need to insert div element with a proper class, and make a ajax request in order to render captcha. This call would insert an iframe into a given div. What I need is to know how to access that iframe's content without using AJAX.
Turns out we are not supposed to do that kind of tricks with reCAPTCHA.
There is no support for that in API. It seems that it was part of Google's design to prevent that kind of usage.
The only walkaround I could come up with is to implement a WebView widget with JavaScript support, get website via http, and load it into this webview, centering this view around the form we want to post.
It seems like a lot of work though, thus I'm going to simply skip this, if someone successfuly manages to figure it out I'd appreciate a hint :)

Prevent iframe from opening in a new window

I have seen some answers about it but i have a same issue that is rather a little more complex.
I have a site about tourism build in wordpress localy and i have integrated in it some iframes from booking.com
The iframes are working good but when you click on the links inside it opens on a new window. All i want is to reload inside the iframe.
Also if some have worked with booking.com before i would like to ask...when you search from there search box and hit search is there a way not to open in a new window but instead in a new page inside the site?
In this case, due to cross-domain policy restrictions, you simply cannot control any of the booking.com iframe. That's by design, for security reasons. Unless you deal with a same-origin iframe (i.e. from the same domain name) there is nothing you can do here. You depend on booking.com's implementation entirely.
You may want to consider a plugin like http://wordpress.org/plugins/booking-search-hotel/ (found from a quick search) or see if other XML API solutions are available for more control.

Is there a way to get bookmarks information WITHOUT using JS?

I've been doing some research on this and I'm still not sure if it's possible.
Is there any way to retrieve a user's bookmarks and display them on the page without violating their privacy? I saw these two threads talking about using JS to do this:
How to get Bookmarks toolbar information in JavaScript code?
Show all bookmarks using javascript
I'm not thinking about doing this automatically, users would have to opt-in with a button that said "Display Bookmarks from My Browser" or something similar.
Is it possible?
Not without browser extensions. You could write a browser extension for the major browsers which retrieves the information and feeds it back to your page.

Resources