I have an application which has a listbox. When an item in the list is clicked the app takes us to a new page with a web browser which displays the contents of that particular item (we get these from a particular list which is previously parsed xml data) in a web browser (because they also contain html elements). This all works perfectly fine.
Now, there are a few items in the list which contain a link. The link displays in the browser and when clicked it takes us to a .pdf file (still in the webbrowser) which is not being displayed.
What I now wonder is:
How to check if the link is being clicked? Is there an event for that?
How can I display the .pdf within the webbrowser control without the aid of other application?
Thank you,
Should you need any code that's currently working and written just ask.
To know if the link is clicked, you can use the Navigating event of the webbrowser.
Unfortunately, you can't use the webbrowser to display the PDF. You'll have to use a WebBrowserTask instead.
To sum it up, in your case you can use the Navigating event to detect the click on the link (since it's apparently important from you), then cancel the navigation (by setting e.Cancel = true in the event handler), then call the WebBrowserTask to display the PDF document.
Related
I discovered a strange anomaly with GTM event Triggers.
I am capturing event clicks on PDF documents on my web pages and triggering an event record to my Google Analytics. The trigger is shown in the attached screen shot.
(1) when you click a PDF document on the web page (link does not contain a target="_blank" attribute in the html markup), the PDF opens in the current tab and a GA event is recorded -- "success".
(2) when you right-click a PDF document on the web page (link does not contain a target="_blank" attribute in the html markup), and open the link in a new tab or a new window, the PDF opens and a GA event is NOT recorded -- "NO success".
How can I adjust my GTM trigger to successfully capture and record event clicks opened in new tabs and new windows?
I've run into this before, and never found a solution; I think it's just the nature of the way GTM tracks people.
Every click on the web page triggers the click listener, which quickly identifies the DOM element you were clicking on, and sends a small packet of data to GTM.
However, right clicking is not the same thing, and doesn't trigger this behavior. The menu that then appears is not part of the web page, so a click on there won't be noticed by GTM.
I can think of two ways around this; the first would be to write your own click listener that listens for right clicks. Simo Ahava has some great advice about this. http://www.simoahava.com/analytics/custom-event-listeners-gtm/ The issue here is that, unlike a regular click, a right click doesn't guarantee that somebody will travel through a link.
The other would be to put custom code into either your buttons or your links that would allow you to track them without relying on the click listener in the first place. However, I suspect that this would be a lot more trouble than it's worth.
Because right-clicking and opening in a new tab is not a "click" in the eyes of JavaScript. It is however an event that can be tracked. It will require the use of jQuery and a GTM Variable that is Custom JavaScript.
This post has decent instructions on tracking it.
How to Track "Open New Tab" traffic in Google Analytics
I have a news-type website that I am looking to create using N2CMS, but besides the regular operations (being able to see a calendar, viewing lists of news, viewing news details etc.), part of the content in the website is displayed in "modal" popups (similar to the ModalPopupExtender from the AjaxToolkit) inside the page (for example if you click Login, a popup panel appears with the login controls).
My question is: is there a way of adding a handler for a link, and displaying a "modal" popup when the link is clicked? If so, can this be done from the template GUI editor (and how)?
Thank you
N2CMS doesn't have any built-in handlers to create modal pop-ups for links. However, N2CMS does ship with the Jquery JavaScript library. My suggestion would be to use JavaScript in your site template to select and format the desired links with modal dialogs -- but that can't be done from the GUI editor, you'd need to do it in the template code directly.
I've created a customcontrol with a repeatcontrol showing a panel for each related document (of a notes doccollection). The xpage arround the cc is bound to a maindocument.
The panel in the repeatcontrol contains some inputfields, a fileuploadcontrol, a filedownloadcontrol and an action-button.
If the user select a file in the fileuploadcontrol an press the button, then the document bound to the panel is saved and an notesagent replace the old attachment with the new selected.
After that, the current panel should be refreshed, so that the filedownloadcontrol shows the right attachment for download. But only the current panel should be refreshed, not the complete xpage or other panels in the repeatcontrol (context.reloadPage is not the solution I need).
Any idea?
I suggest you put all your code in the button and then partial refresh the panel in the button.
But I suspect that the question refres to that you cannot save a file attachment using partial refresh. which is true. there are a few solutions to this, like using an iframe. do a google search on that
An example for using iframes is described at the Domino development wiki. The mentioned approach is used in the Lead Manager X example at OpenNTF.
However, depending on whether or not that fits your needs, you may also consider using the XPages Exension Library, specifically the Dynamic Pages therein.
did you try giving the partial refresh id for the panel containing the document? If that doesnt work.. get the handle of the particular panel in clientside and refresh it. Panel inside repeat can be identified with its index.
This is a real 2%er but here goes, I have created a winform in VS2010 with Gecko 2.0.1-0.10 (latest release) webbrowser control, I am using a touch screen to navigate. Sometimes when clicking a hyperlink it will select text rather than navigate, on the DomMouseUp event I want to check to see if there is selected text, if so I want to see if it is a hyperlink and if it is, where that hyperlink goes to. I had a mess around with GeckoSelection but nothing looked obvious. I am looking for a way to see if what is selected within the web browser is a hyperlink, any thoughts?
I've worked it out : for anyone interested in such things, use DomFocus on the gecko control:
m_strInnerHtml = geckSel.ActiveElement.Parent.InnerHtml.ToString();
That will give you the innerhtml of the selected item, from here you can extract the href tag and get the url, navigate to it, hey presto :)
Update: An even better solution is to use (in DomFocus again)
m_strInnerHtml = geckoWebBrowser.Document.ActiveElement.GetAttribute("href");
This will return the actual hyperlink address, one thing to watch out for however is if you're on google for example and select the "Advertising" hyperlink at the bottom of the page, it may return "/advertisingpage/" which must be appended to the original url. Clicking a hyperlink away from google will return the full address however.
Very good behavior gives this call:
m_strInnerHtml = geckoWebBrowser1.Url.AbsoluteUri()
I'm creating an app on Windows Phone 7 that lets folks read offline HTML content. Is there a way to show an inline browser or HTML viewing control?
The WebBrowser control allows you to display arbitrary HTML.
There are two methods on the WebBrowser control you can use to display HTML:
Navigate() will display the contents of a file located at the supplied URL. This file can be in IsolatedStorage or on a server.
NavigateToString() will display the html string you give it.
In your case I'm guessing you'd use a WebClient object to download the webpage to offline storage, then the Navigate method to display it.
However, the benefit of NavigateToString is that you can munge the string on the way in to do some cool (or essential) stuff like style the page so it matches perfectly with the current phone theme, or catch all link clicks and make them pop in the external browser (otherwise they load in the very same WebBrowser control).
I've documented the details of styling and link clickery here.
Yes, there's a WebBrowser control in Microsoft.Phone.Controls
If you then save your (offline) files to IsolatedStorage you can then view the file via a call like this from code:
webBrowser1.Navigate(new Uri("offline-file-name.html", UriKind.Relative));
Things to note:
You can use directories within isolated storage. Just specify the whole path in the Uri.
If navigating between offline pages, all paths must be relative.