WebBrowser content manipulation - windows-phone-7

I am using a WebBrowser control and loading a website. However, there is a button whose placement i need to change via JavaScript.I dont have any control over that website. Once that website is loaded in WebBrowser control, I need to run my custom JS so that i can change the position of button.
How do i do this ?

If you have no control over the website/contents, there is no elegant way to do this. Methods like InvokeScript work only with scripts available in the loaded document. See this
A crude and expensive way would be to get the website's content(html), and adding your script, loading it from the storage or data structure you've used and displaying the content, with access to the function via InvokeScript. I will not recommend it.

Related

Umbraco - how to insert clickable images into page?

I am a beginner with Umbraco. I am able to upload images to the Media Library and then put them onto the page, but for my sidebars I want the images to be clickable links to other parts of my site and other sites.
At the moment I am using the Rich Text Editor to write an anchor tag etc. but this seems ridiculous and I don't want content authors [attempting to be] writing HTML.
It seems like there should be a built-in data type for this, or a property on the image but I see nothing. Do I need to write my own Razor code as a DataType? This seems like such a common thing that I'm surprised there is not a built-in solution.
I'm using 7.2.8
If you're already using the RTE, you can just select the image and click the Link button, then whatever you have selected (in this case the image) should become a link. No need to make your own HTML :-)

How to display popup with html in firefox bootstrapped extensions?

I developed a firefox bootstrapped extension (without add-on sdk). I need to display a popup with html content, something like panel in add-on sdk. Also, it is necessary that the extension could interact with content in the popup. Also, I need a way to display html content in separate tab and interact with this content. So what can I use to implement what I need?
You can append an iframe to that panel, and then load a page into that iframe. That's what I did in this simple addon here - https://github.com/Noitidart/AwesomeBar-Power-Tip/
Here's another gist that does something similar - https://gist.github.com/Noitidart/9445992
I think this is how the SDK does it as well.
but I can not understand how it is possible to implement the interaction between expansion and content inside the panel.
The panel or its frameLoader property should have a messageManager, which can be used to load frame scripts and pass messages to them.

How to perform Preview in CKEditor

I am using CKEditor to get HTML from the user. The user will use HTML tags and it will be saved in the database. I need a functionality for the user to see how the page will be displayed when open as .html before saving in the database.
Is it possible to do that using CKEditor and if yes.....then how?
Thanks-in-Advance
It's certainly possible, but depends a lot on your specific requirements.
Get the contents of the editor using editor.getData(), then open a pop up window displaying that content - this should be relatively simple with JavaScript so I won't give any examples - you'll have to try it yourself first :). If a pop up is not something you want to use, maybe use an inline dialog, such as the ones that jQuery uses.
I would create the workflow so that the preview box has a save button inside it, forcing the user to preview before saving. If that's not acceptable, then create a separate button on your page to do the preview.

Opening a bar on top of the page with firefox sdk

I am making a firefox pluggin and I want to open a "topbar" on a few websites. Realy, it would be a few informations about the curent page a link back to my own website. What would be te best way to do that ?
My first idea was to use content script, but that seems to be a very bad practice. I also read about panels, here are my questions :
How can I add my pannel just under the adressbar ?
How can I only open in it on the website I need ?
thx.
Using content script is completely fine.
It is modern, simple, less-code, more compatible way
to add top-panel to some web pages.
Also, code of content script is not injected to the web page, it just uses the dom and context; page script has no access (if you do not provide it explicit) to content script.
The only possible disadvantage is that panel would not look like native part of the browser.
If I convienced you to use content script:
The module you really need in your plugin page-mod
Using Add-on Builder you make have your plugin in a day

How do I let a user browse HTML/WebSite content without launching the browser (need an inline browser)?

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.

Resources