Populating parent window from a child window - populate

I am working on a website. Here I want to import gmail contacts. To achieve this, in the parent page(php), I have added a link as mentioned below.
<a style="font-size:25px;font-weight:bold;" href="https://accounts.google.com/o/oauth2/auth?client_id=213413545397468.apps.googleusercontent.com&redirect_uri=https://localhost/oauth/oauth.php&scope=https://www.google.com/m8/feeds/&response_type=code" onclick="window.open(this.href,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=880,height=550'); return false;">Click here to Import Gmail Contacts</a>
Below this link there is a textarea, where I want to populate all gmail addresses.
When I click on this link, a new popup window is opened which allows me to log in to gmail. Once I log in, it displays all the gmail addresses in the address book in the popup window itself.
As mentioned earlier, I want to populate the textarea with the gmail address. So, for that I have added a javascript in the child php to populate the parent page.
window.opener.document.getElementById('textarea').value ='email addresses';
But nothing gets populated in the textarea.

Related

Local storage event listener not working in Firefox

I have a sandbox iframe which is hosted by various websites. Lets assume that this iframe is loaded like this:
'src="https://example.com/wie.js"' I have already added 'allow-scripts allow-forms allow-modals allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-storage-access-by-user-activation' at sandbox. I also use document.requestStorageAccess() from inside the iframe and I set event listeners for the storage like this:
window.addEventListener('storage', onStorageFunc, false);.
From the iframe a popup window is presented when user clicks a specific button and the popup opens at lets say at this url "https://paypal.com". After user navigation on popup, paypal at the end of the flow redirects user to this url "https://example.com/success". At this point when user is navigated to /success I add some data to local storage which I expect to trigger the storage event listener and the onStorageFunc to run.
This doesn't happen, while in other browsers it works as expected.
Since both popup and iframe are under the same url (https://example.com) and I have used requestStorageAccess, I would expect this to work normally. Can you please help me to find out what is going wrong here? In the past I had the same problem but it was fixed when I added 'requestStorageAccess' and 'allow-storage-access-by-user-activation'. Now I can see it happening again.

Hyperlink re-directing to a masked URL

I am managing an e-mail campaign (containing HTML) for a customer of ours, and I am in the middle of a situation where I can't reproduce what is happening.
When I insert a hyperlink in the message body with the customer's website like : https://customer.com and send the campaign through "SendGrid" (our delivery service)a user clicks on the hyperlink in their e-mail, then it takes them somewhere completely different, it seems like the URL is masked.
When I then check the HTML source of the e-mail, instead of the link being https://customer.com it is http://https://customer.com
If I copy paste the URL in the browser then it works fine. If I create an HTML locally with the hyperlink to the customer's website, it still works fine.
Can there be something the customer needs to activate in their end?

Monitor click events on bookmarks (Google Apps Script)

Is there a way to monitor click events on bookmarks in google documents with google apps script? I want to get bookmark id when someone selects a bookmark and than run some more code which needs that bookmark id to get processed.
With Brian Bennett's help I managed to solve this issue with Web Apps. There is a little bit more code to write but it works.
Write a doGet function:
doGet function is called when a user visits your Web App. With doGet function I opened a document with ID given through get parameters and displayed it as html. To get a html of the document I used this function.
Find and display bookmarks:
You can find bookmarks in the html of the document as html tag with id of the bookmark. I changed the css of all this tags so I could see them (change background, height, width or something like that).
listen to click events on bookmarks with jquery or just javascript:
Listen to click events on those tags (bookmakrs) with jquery or javascript. If you use jquery, you need to import a jquery library. When click event happens get the id of the bookmark from the id attribute of the tag.
Use that bookmark id as you wish...

How can I set up login using Fancybox?

I am trying to open a control panel in FANCYBOX.
I have a form in my page which its action and field names are same as another website and once user submit it they will redirect to their control panel in that website in a new window.
What I want is to open it in fancybox. I do not want to user leave my page, I just want them to access to that panel inside my website.
And also I want to all links of the opened frame target be _parent. I mean if they go to different parts of their panel it shows in the same fancybox not open a new window.
You might wanna look at iframe i.e. Add class='iframe' to a link check it on this page.

AJAX webpage to navigate on previous page

The data is displayed in gridview with paging on an AJAX enabled webpage. The gridView contains Item templates containing a link button. On itemCommand event, page redirects to display data in new page. When the Back button on browser is pressed, the previous state of the page doesn't load.
Perhaps set a cookie and use it to get the right page when initializing the gridview. Or modify the hash at the end of the URL (eg, add "#page2" to the location bar and read it back on init).
Look at this js stuff from google
Use Google Web Toolkit, it allows the state to be bookmarked and isn't affected by back/forward button.
Otherwise your options are:
Telling the user to not press the back button.
Putting the state in the url, e.g mypage.asp#page_123 and using that to determine the state in your javascript at page load.

Resources