הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   שאלה| iframe, כיצד עושים את זה ? (https://hosts.co.il/forums/showthread.php?t=98563)

Bittan 12-07-12 21:13

שאלה| iframe, כיצד עושים את זה ?
 
כאשר אני יוצר פריים, נניח של גוגל:

PHP קוד:

<iframe src="http://www.google.co.il/" 
width="918" height="227" scrolling="no" frameborder="0">
</
iframe

מה הבעיה בעצם ?
הפריים מציג לי את החלק העליון, נניח אני רוצה שהפריים יציג לי את החלק האמצעי ישר ?
אם לא הבנתי, תעתיקו את הקוד ואתם תראו הכל לבן (גוגל), נניח ואני רוצה שישר יופיע התיבת
חיפוש של גוגל, כאילו שהפריים יהיה באמצע האתר ולא בחלק העליון, מקווה שהבנתם.

תודה רבה.

IgalSt 12-07-12 21:34

במידה ומדובר בדומיין השונה משלך, זה יהיה בלתי אפשרי מאחר והוא מפר את עקרון ה- Same origin policy

Bittan 12-07-12 21:36

ציטוט:

נכתב במקור על ידי IgalSt (פרסם 850840)
במידה ומדובר בדומיין השונה משלך, זה יהיה בלתי אפשרי מאחר והוא מפר את עקרון ה- Same origin policy

לא הבנתי את מה הוא מפר, אפשר הסבר בבקשה ?
ובכל מקרה, כיצד זה אפשרי מה שביקשתי ?

Tomer 12-07-12 22:21

קראת את ההסבר בויקיפדיה שיגאל קישר אליו ?

In computing, the same origin policy is an important security concept for a number of browser-side programming languages, such as JavaScript. The policy permits scripts running on pages originating from the same site to access each other's methods and properties with no specific restrictions, but prevents access to most methods and properties across pages on different sites.

הרעיון הוא שקוד JavaScript באתר אחד (דומיין אחד) לא יוכל לעולם להשפיע על דומיין אחר.

מה שכן, מצאתי תגובה ב- Stack Overflow שמדברת על האפשרות לעקוף את העניין בצורה קצת מכוערת:

http://stackoverflow.com/questions/1...ith-javascript

you can circumvent the same origin policy by having doubling up on iframes. Your main page embeds an iframe to a shim page on your own server. The shim page in turn just embeds an iframe of the foreign page. The master page can scroll the shim page since they're in the same origin

Bittan 12-07-12 23:06

ציטוט:

נכתב במקור על ידי Tomer (פרסם 850848)
קראת את ההסבר בויקיפדיה שיגאל קישר אליו ?

In computing, the same origin policy is an important security concept for a number of browser-side programming languages, such as JavaScript. The policy permits scripts running on pages originating from the same site to access each other's methods and properties with no specific restrictions, but prevents access to most methods and properties across pages on different sites.

הרעיון הוא שקוד JavaScript באתר אחד (דומיין אחד) לא יוכל לעולם להשפיע על דומיין אחר.

מה שכן, מצאתי תגובה ב- Stack Overflow שמדברת על האפשרות לעקוף את העניין בצורה קצת מכוערת:

http://stackoverflow.com/questions/1...ith-javascript

you can circumvent the same origin policy by having doubling up on iframes. Your main page embeds an iframe to a shim page on your own server. The shim page in turn just embeds an iframe of the foreign page. The master page can scroll the shim page since they're in the same origin

אני לא בקי באנגלית, אפשר בבקשה את הקוד או את ההסבר בעברית בבקשה ?

Tomer 12-07-12 23:13

את הקוד כמובן שלא, אבל הסבר קצר בעברית אפשר גם אפשר.

הרעיון הוא להטמיע iframe בתוך iframe.

כלומר, עמוד X מטמיע את google.com ועמוד Y מטמיע את עמוד X וכך ניתן לבצע פעולות JavaScript על עמוד X דרך עמוד Y.

קרא על זה קצת... זה אמור לעבוד.

Haimz 13-07-12 11:12

או שהאפשרות השנייה שלך היא לצור פשוט input וכפתור חיפוש ולהפנות לגוגל

IgalSt 13-07-12 12:09

ציטוט:

נכתב במקור על ידי Tomer (פרסם 850848)
מה שכן, מצאתי תגובה ב- Stack Overflow שמדברת על האפשרות לעקוף את העניין בצורה קצת מכוערת:

http://stackoverflow.com/questions/1...ith-javascript

you can circumvent the same origin policy by having doubling up on iframes. Your main page embeds an iframe to a shim page on your own server. The shim page in turn just embeds an iframe of the foreign page. The master page can scroll the shim page since they're in the same origin

וואלה, פתרון יפה שלא הכרתי. אבל כשחושבים על זה - הוא כ"כ פשוט :)

תודה!


כל הזמנים הם GMT +2. הזמן כעת הוא 18:43.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ