By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,934 Members | 1,476 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,934 IT Pros & Developers. It's quick & easy.

Get Selected HTMl

P: 59
Hi
Is it possible for a js or client side script to show the user any site that they enter, then let then select a certain area (possibly with a crop tool) and the script to get the html code for the selected area? how could i do this? any help would be really appreciated.

thanks
Apr 8 '08 #1
Share this Question
Share on Google+
19 Replies


acoder
Expert Mod 15k+
P: 16,027
I've seen what you're looking for on Webwag: their Widget On Demand feature.
Apr 9 '08 #2

P: 59
I've seen what you're looking for on Webwag: their Widget On Demand feature.
How would you go about doing this?
Apr 10 '08 #3

acoder
Expert Mod 15k+
P: 16,027
Firstly, try using a cropper tool to get content from your own site. Search for one - you should find some good ones.

Once you get that working, you now need to get the other site from your domain to avoid cross-domain issues. To do that, make a Http request from the server-side to get the page onto your own domain.
Apr 10 '08 #4

P: 59
Hi
How would you adjust the cropper tool to work with html though. It is my understanding they only work for images?
Thanks
Apr 11 '08 #5

acoder
Expert Mod 15k+
P: 16,027
They use an image cropper (Defusion's), get the dimensions and use that to get the part of the page from the HTML. See the source code.
Apr 11 '08 #6

P: 59
They use an image cropper (Defusion's), get the dimensions and use that to get the part of the page from the HTML. See the source code.
Sorry but i still dont understand how do you use dimensions, to crop html? and also will this update dynamicaly?

Thanks
Apr 11 '08 #7

acoder
Expert Mod 15k+
P: 16,027
Look at the source code of webwag_sel.php. Use Firebug to inspect elements. Of course, this is only one site - there may be others with similar code.
Apr 12 '08 #8

P: 59
Look at the source code of webwag_sel.php. Use Firebug to inspect elements. Of course, this is only one site - there may be others with similar code.
Hi
i've worked out that webwag is just using frames. I found this one which works how i would like mine too grid.orch8.net/
How can i make something like this?

Thanks
Apr 12 '08 #9

acoder
Expert Mod 15k+
P: 16,027
They both use iframes, as would probably any similar website.

Interesting that they allow you to select elements rather than select an area of the page. If anything, that would be easier to implement.

Again, the source JavaScript files are there for you to look at. You may find more information on their blog.

I would suggest you start off with something small and simple and then extend it.
Apr 12 '08 #10

P: 59
They both use iframes, as would probably any similar website.

Interesting that they allow you to select elements rather than select an area of the page. If anything, that would be easier to implement.

Again, the source JavaScript files are there for you to look at. You may find more information on their blog.

I would suggest you start off with something small and simple and then extend it.
Hi
I have got most of it to work extracting the javascripts but the one thing that doesnt work is when the site wont load in the selection interface, i think this requires php to fetch the html or contents, could you help me fix all this up? are you sure its using iframes, because when the widget is created the html is sometimes formated differently i think they are utilizing dom structure, or js to get php parsing points but i dont know?

Thanks

Thanks
Apr 12 '08 #11

acoder
Expert Mod 15k+
P: 16,027
I have got most of it to work extracting the javascripts but the one thing that doesnt work is when the site wont load in the selection interface, i think this requires php to fetch the html or contents, could you help me fix all this up?
I mentioned about this earlier. You need to get the website content onto your domain before you can manipulate it. Use cURL - ask in the PHP forum for more details.
are you sure its using iframes, because when the widget is created the html is sometimes formated differently i think they are utilizing dom structure, or js to get php parsing points but i dont know?
They use iframes for the initial part, though you could use Ajax. The HTML might be formatted differently if it's within a parent container which isn't included or the CSS is not copied.
Apr 13 '08 #12

P: 59
I mentioned about this earlier. You need to get the website content onto your domain before you can manipulate it. Use cURL - ask in the PHP forum for more details.
They use iframes for the initial part, though you could use Ajax. The HTML might be formatted differently if it's within a parent container which isn't included or the CSS is not copied.

Hi
I think this job is too complicated for me, would you do this freelance?

Thanks
Apr 13 '08 #13

acoder
Expert Mod 15k+
P: 16,027
Not on this site, I'm afraid. You could try some popular freelance sites.

However, if you have a real job in mind with sufficient renumeration, put a job posting up in the IT Jobs forum.
Apr 14 '08 #14

P: 59
Not on this site, I'm afraid. You could try some popular freelance sites.

However, if you have a real job in mind with sufficient renumeration, put a job posting up in the IT Jobs forum.

Ok so ive decided to continue with this as i cannot afford freelancing. Im having major problems getting the site to load though, there are quite a few files in the folder, can anyone help me get the site to load ? any help is really appreciated. if anyone has any resources which may help please tell me.

thanks
Olie
Apr 21 '08 #15

acoder
Expert Mod 15k+
P: 16,027
Can you give a link to a test page?

Without seeing some code, it's difficult to say what the problem might be.
Apr 22 '08 #16

P: 59
Ok here i have atached the files im trying.

thansk
Attached Files
File Type: zip grid.orch8.net 2.zip (270.2 KB, 518 views)
Apr 27 '08 #17

acoder
Expert Mod 15k+
P: 16,027
Can you find the parts where you're having problems and show that code.

Remember that there's two parts to this. If you want help with the server-side part, ask in the appropriate forum, e.g. PHP. For the client-side (DHTML/JavaScript/Ajax) part, ask away here.
Apr 28 '08 #18

P: 59
Can you find the parts where you're having problems and show that code.

Remember that there's two parts to this. If you want help with the server-side part, ask in the appropriate forum, e.g. PHP. For the client-side (DHTML/JavaScript/Ajax) part, ask away here.
ok i think this might need some server side to get the html, i can do this but i just dont know where to put it in this javascript ( i dont understand js) where should i put the code to get the site? I have tried adding it into the clipping page with no luck, what would the url array be in js and where should i put the php to get the site?

Thanks
Apr 28 '08 #19

acoder
Expert Mod 15k+
P: 16,027
ok i think this might need some server side to get the html, i can do this but i just dont know where to put it in this javascript ( i dont understand js) where should i put the code to get the site? I have tried adding it into the clipping page with no luck, what would the url array be in js and where should i put the php to get the site?
Try not to worry about doing everything at once.

If you do it step by step and design your solution, you'll learn and understand more and also get each part working.

Firstly, see if you can get the selected part of a page from your own domain (forget about getting another website for now).
Apr 29 '08 #20

Post your reply

Sign in to post your reply or Sign up for a free account.